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.
Members
-
<static> PageLayout
-
Properties:
Name Type Description e_Default
number e_SinglePage
number e_OneColumn
number e_TwoColumnLeft
number e_TwoColumnRight
number e_TwoPageLeft
number e_TwoPageRight
number -
<static> PageMode
-
Properties:
Name Type Description e_UseNone
number e_UseThumbs
number e_UseBookmarks
number e_FullScreen
number e_UseOC
number e_UseAttachments
number -
<static> ViewerPref
-
Properties:
Name Type Description e_HideToolbar
number e_HideMenubar
number e_HideWindowUI
number e_FitWindow
number e_CenterWindow
number e_DisplayDocTitle
number
Methods
-
<static> create(tr)
-
Parameters:
Name Type Description tr
PDFNet.Obj Returns:
A promise that resolves to an object of type: "PDFNet.PDFDocViewPrefs"- Type
- Promise.<PDFNet.PDFDocViewPrefs>
-
copy()
-
Copy Constructor
Returns:
A promise that resolves to an object of type: "PDFNet.PDFDocViewPrefs"- Type
- Promise.<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
- Promise.<boolean>
-
getLayoutMode()
-
Returns:
A promise that resolves to the value of currently selected PageLayout property.- Type
- Promise.<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
- Promise.<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
- Promise.<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 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
- Promise.<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
- Promise.<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
- Promise.<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
- Promise.<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
- Promise.<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
- Promise.<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. Returns:
- Type
- Promise.<void>
-
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);
Returns:
- Type
- Promise.<void>
-
setLayoutMode(mode)
-
Sets PageLayout property and change the value of the PageLayout key in the Catalog dictionary.
Parameters:
Name Type Description mode
number 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.Returns:
- Type
- Promise.<void>
-
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 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.Returns:
- Type
- Promise.<void>
-
setPageMode(mode)
-
Sets PageMode property and change the value of the PageMode key in the Catalog dictionary.
Parameters:
Name Type Description mode
number 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.Returns:
- Type
- Promise.<void>
-
setPref(pref, value)
-
sets the value of given ViewerPref property.
Parameters:
Name Type Description pref
number 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. Returns:
- Type
- Promise.<void>
-
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 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.Returns:
- Type
- Promise.<void>
-
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 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.Returns:
- Type
- Promise.<void>
-
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 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.Returns:
- Type
- Promise.<void>
-
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 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.Returns:
- Type
- Promise.<void>