# Initial View Settings

DsPdf is a Document Solutions product that offers a rich library to read, create, modify, and save PDF files without using any external tool.

## Content

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:

```javascript
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:

```javascript
var viewerPreferences = await viewer.viewerPreferences;
var openAction = viewerPreferences.openAction;
```

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

```javascript
// 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:

```javascript
var viewerPreferences = await viewer.viewerPreferences;
var pageMode = viewerPreferences.pageMode;
```

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

```javascript
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:

```javascript
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 | <ul><li>Single Page Continuous</li><li>Two-Up (Facing)</li><li>Two-Up Continuous (Facing)</li><li>Two-Up (Cover Page)</li><li>Two-Up Continuous (Cover Page)</li></ul> |
| User Interface Options | <ul><li>Hide menu bar</li><li>Hide window controls</li></ul> |
| Window Options | <ul><li>Resize window to initial page</li><li>Center window on screen</li><li>Show (File Name and Document Title)</li></ul> |
