Class: PDFDocViewPrefs

PDFNet. PDFDocViewPrefs


new PDFDocViewPrefs()

PDFDocViewPrefs is a high-level utility class that can be used to control the way the document is to be presented on the screen or in print.

PDFDocViewPrefs class corresponds to PageMode, PageLayout, and ViewerPreferences entries in the document's catalog. For more details please refer to section 8.1 'Viewer Preferences' in PDF Reference Manual.

Methods


<static> create(tr)

Parameters:
Name Type Description
tr PDFNet.Obj
Returns:

A promise that resolves to an object of type: "PDFDocViewPrefs"

Type
PDFNet.PDFDocViewPrefs

copy()

Copy Constructor

Returns:

A promise that resolves to an object of type: "PDFDocViewPrefs"

Type
PDFNet.PDFDocViewPrefs

getDirection()

Returns:

A promise that resolves to true is the predominant reading order for text is left to right, false otherwise. See SetDirection() for more information.

Type
boolean

getLayoutMode()

Returns:

A promise that resolves to the value of currently selected PageLayout property.

Type
number
Example
Return value enum:
<pre>
PDFNet.PDFDocViewPrefs.PageLayout = {
	e_Default : 0
	e_SinglePage : 1
	e_OneColumn : 2
	e_TwoColumnLeft : 3
	e_TwoColumnRight : 4
	e_TwoPageLeft : 5
	e_TwoPageRight : 6
}
</pre>

getNonFullScreenPageMode()

Returns:

A promise that resolves to the PageMode used after exiting full-screen mode.

Type
number
Example
Return value enum:
<pre>
PDFNet.PDFDocViewPrefs.PageMode = {
	e_UseNone : 0
	e_UseThumbs : 1
	e_UseBookmarks : 2
	e_FullScreen : 3
	e_UseOC : 4
	e_UseAttachments : 5
}
</pre>

getPageMode()

Returns:

A promise that resolves to the value of currently selected PageMode property.

Type
number
Example
Return value enum:
<pre>
PDFNet.PDFDocViewPrefs.PageMode = {
	e_UseNone : 0
	e_UseThumbs : 1
	e_UseBookmarks : 2
	e_FullScreen : 3
	e_UseOC : 4
	e_UseAttachments : 5
}
</pre>

getPref(pref)

Parameters:
Name Type Description
pref number/enum
PDFNet.PDFDocViewPrefs.ViewerPref = {
	e_HideToolbar : 0
	e_HideMenubar : 1
	e_HideWindowUI : 2
	e_FitWindow : 3
	e_CenterWindow : 4
	e_DisplayDocTitle : 5
}

the ViewerPref property type to query.

Returns:

A promise that resolves to the value of given ViewerPref property.

Type
boolean

getPrintArea()

Returns:

A promise that resolves to the page boundary representing the area of a page to be rendered when printing the document.

Type
number
Example
Return value enum:
<pre>
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}
</pre>

getPrintClip()

Returns:

A promise that resolves to the page boundary to which the contents of a page are to be clipped when printing the document.

Type
number
Example
Return value enum:
<pre>
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}
</pre>

getSDFObj()

Returns:

A promise that resolves to document's SDF/Cos 'ViewerPreferences' dictionary or NULL if the object is not present.

Type
PDFNet.Obj

getViewArea()

Returns:

A promise that resolves to the page boundary representing the area of a page to be displayed when viewing the document on the screen.

Type
number
Example
Return value enum:
<pre>
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}
</pre>

getViewClip()

Returns:

A promise that resolves to the page boundary to which the contents of a page are to be clipped when viewing the document on the screen.

Type
number
Example
Return value enum:
<pre>
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}
</pre>

setDirection(left_to_right)

sets the predominant reading order for text.

This flag has no direct effect on the document's contents or page numbering but can be used to determine the relative positioning of pages when displayed side by side or printed n-up.

Parameters:
Name Type Description
left_to_right boolean

true if the predominant reading order for text is from left to right and false if it is right to left (including vertical writing systems, such as Chinese, Japanese, and Korean). Default value: left_to_right is true.


setInitialPage(dest)

A utility method used to set the fist page displayed after the document is opened. This method is equivalent to PDFDoc::SetOpenAction(goto_action).

If OpenAction is not specified the document should be opened to the top of the first page at the default magnification factor.

Parameters:
Name Type Description
dest PDFNet.Destination

A value specifying the page destination to be displayed when the document is opened.

Example:

Destination dest = Destination::CreateFit(page);
pdfdoc.GetViewPrefs().SetInitialPage(dest);

setLayoutMode(mode)

Sets PageLayout property and change the value of the PageLayout key in the Catalog dictionary.

Parameters:
Name Type Description
mode number/enum
PDFNet.PDFDocViewPrefs.PageLayout = {
	e_Default : 0
	e_SinglePage : 1
	e_OneColumn : 2
	e_TwoColumnLeft : 3
	e_TwoColumnRight : 4
	e_TwoPageLeft : 5
	e_TwoPageRight : 6
}

New PageLayout setting. Default value is e_SinglePage.


setNonFullScreenPageMode(mode)

set the document's page mode, specifying how to display the document on exiting full-screen mode.

Parameters:
Name Type Description
mode number/enum
PDFNet.PDFDocViewPrefs.PageMode = {
	e_UseNone : 0
	e_UseThumbs : 1
	e_UseBookmarks : 2
	e_FullScreen : 3
	e_UseOC : 4
	e_UseAttachments : 5
}

PageMode used after exiting full-screen mode. Default value: e_UseNone.


setPageMode(mode)

Sets PageMode property and change the value of the PageMode key in the Catalog dictionary.

Parameters:
Name Type Description
mode number/enum
PDFNet.PDFDocViewPrefs.PageMode = {
	e_UseNone : 0
	e_UseThumbs : 1
	e_UseBookmarks : 2
	e_FullScreen : 3
	e_UseOC : 4
	e_UseAttachments : 5
}

New PageMode setting. Default value is e_UseNone.


setPref(pref, value)

sets the value of given ViewerPref property.

Parameters:
Name Type Description
pref number/enum
PDFNet.PDFDocViewPrefs.ViewerPref = {
	e_HideToolbar : 0
	e_HideMenubar : 1
	e_HideWindowUI : 2
	e_FitWindow : 3
	e_CenterWindow : 4
	e_DisplayDocTitle : 5
}

the ViewerPref property type to modify.

value boolean

The new value for the property.


setPrintArea(box)

sets the page boundary representing the area of a page to be rendered when printing the document.

Parameters:
Name Type Description
box number/enum
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}

printing region. The default value is page crop-box.


setPrintClip(box)

sets the page boundary to which the contents of a page are to be clipped when printing the document.

Parameters:
Name Type Description
box number/enum
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}

printing clip region. The default value is page crop-box.


setViewArea(box)

Sets the page boundary representing the area of a page to be displayed when viewing the document on the screen.

Parameters:
Name Type Description
box number/enum
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}

page boundary displayed when viewing the document on the screen. By default, PDF viewers will display the crop-box.


setViewClip(box)

sets the page boundary to which the contents of a page are to be clipped when viewing the document on the screen.

Parameters:
Name Type Description
box number/enum
PDFNet.Page.Box = {
	e_media : 0
	e_crop : 1
	e_bleed : 2
	e_trim : 3
	e_art : 4
}

screen clip region. The default value is page crop-box.