Document Solutions for PDF
Document Solutions PDF Viewer Overview / View PDF / Features / Initial View Settings
In This Topic
    Initial View Settings
    In This Topic

    DsPdfViewer supports opening a PDF document with initial view settings similar to Acrobat. The initial view settings determine how the document will be initially displayed when opened in the DsPdfViewer. DsPdfViewer client-side API provides a viewerPreferences type that gets information about the initial view settings defined for the PDF document, such as openAction, pageMode, and pageLayout.

    The viewerPreferences property of DsPdfViewer gets the initial view settings information set by a user. Refer to the following example code, which depicts the same:

    Copy Code
    var viewerPreferences = await viewer.viewerPreferences;
    

    The following table lists the settings that can accessed through viewerPreferences:

    Client-Side API Description
    openAction The openAction gets the initial open action information set by the user.
    pageMode The pageMode gets the initial page mode information set by the user.
    pageLayout The pageLayout gets the initial page layout information set by the user.

    Refer to the following example code to get the open action initial view settings:

    Copy Code
    var viewerPreferences = await viewer.viewerPreferences;
    var openAction = viewerPreferences.openAction;
    

    Refer to the following example code to find open action destination page index:

    Copy Code
    // Find open action destination page index.
    const openAction = await viewer.openAction;
    if(openAction && openAction.dest) {
      const pageRef = openAction.dest[0];
      const targetPageIndex = await viewer.resolvePageIndex(pageRef);
    }
    

    Refer to the following example code to get the page mode initial view settings:

    Copy Code
    var viewerPreferences = await viewer.viewerPreferences;
    var pageMode = viewerPreferences.pageMode;
    

    Refer to the following example code to get the page layout initial view settings:

    Copy Code
    var viewerPreferences = await viewer.viewerPreferences;
    var pageLayout = viewerPreferences.pageLayout;
    

    DsPdfViewer also provides a ignoreInitialView option if you wish to load the PDF document without considering the initial view settings specified in the PDF document. Refer to the following example code to ignore the initial view settings:

    Copy Code
    var viewer = new DsPdfViewer("#root", { ignoreInitialView: true } );
    
    Note: This feature is available in both the standard and professional versions of DsPdfViewer.

    Limitation

    There are a few settings that are currently not supported by DsPdfViewer. The unsupported settings are as follows:

    Options Initial View Settings
    Page layout
    • Single Page Continuous
    • Two-Up (Facing)
    • Two-Up Continuous (Facing)
    • Two-Up (Cover Page)
    • Two-Up Continuous (Cover Page)
    User Interface Options
    • Hide menu bar
    • Hide window controls
    Window Options
    • Resize window to initial page
    • Center window on screen
    • Show (File Name and Document Title)