[]
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:
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:
var viewerPreferences = await viewer.viewerPreferences;
var openAction = viewerPreferences.openAction;
Refer to the following example code to find open action destination page index:
// 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:
var viewerPreferences = await viewer.viewerPreferences;
var pageMode = viewerPreferences.pageMode;
Refer to the following example code to get the page layout initial view settings:
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:
var viewer = new DsPdfViewer("#root", { ignoreInitialView: true } );
!type=note
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 |
|
User Interface Options |
|
Window Options |
|