Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
com.foxit.sdk.pdf.DocViewerPrefs Class Reference
Inheritance diagram for com.foxit.sdk.pdf.DocViewerPrefs:

## Public Member Functions
| DocViewerPrefs (PDFDoc document, PDFDictionary pdf_dict) throws com.foxit.sdk.PDFException
| Constructor, with parameters. More...
| DocViewerPrefs (DocViewerPrefs other)
| Constructor, with another document viewer preferences object. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
PDFDictionary | getDict () throws com.foxit.sdk.PDFException
| Get PDF dictionary from current object. More...
int | getNonFullScreenPageMode () throws com.foxit.sdk.PDFException
| Get display mode which specifies how to display the document on exiting full-screen mode when document's display mode is full-screen. More...
int | getPrintArea () throws com.foxit.sdk.PDFException
| Get the page boundary representing the area of a page to be rendered when printing the document. More...
int | getPrintClip () throws com.foxit.sdk.PDFException
| Get the page boundary to which the contents of a page are to be clipped when printing the document. More...
int | getPrintCopies () throws com.foxit.sdk.PDFException
| Get the number of copies to be printed when the print dialog is opened for PDF document. More...
Range | getPrintRange () throws com.foxit.sdk.PDFException
| Get page range information which is used to initialize the print dialog when the print dialog is opened for the PDF document. More...
int | getPrintScale () throws com.foxit.sdk.PDFException
| Get page scaling option to be selected when a print dialog is displayed for PDF document. More...
boolean | getReadingDirection () throws com.foxit.sdk.PDFException
| Get the predominant reading direction for text. More...
boolean | getUIDisplayStatus (int pref) throws com.foxit.sdk.PDFException
| Get UI display status of a specified viewer preference item type. More...
int | getViewArea () throws com.foxit.sdk.PDFException
| Get the page boundary representing the area of a page to be displayed when viewing the document on the screen. More...
int | getViewClip () throws com.foxit.sdk.PDFException
| Get the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. More...
boolean | isEmpty ()
| Check whether current object is empty or not. More...
void | setNonFullScreenPageMode (int display_mode) throws com.foxit.sdk.PDFException
| Set display mode which specifies how to display the document on exiting full-screen mode when document's display mode is full-screen. More...
void | setPrintArea (int box_type) throws com.foxit.sdk.PDFException
| Set the page boundary representing the area of a page to be rendered when printing the document. More...
void | setPrintClip (int box_type) throws com.foxit.sdk.PDFException
| Set the page boundary to which the contents of a page are to be clipped when printing the document. More...
void | setPrintCopies (int print_copies) throws com.foxit.sdk.PDFException
| Set the number of copies to be printed when the print dialog is opened for PDF document. More...
void | setPrintRange (Range page_range) throws com.foxit.sdk.PDFException
| Set the page range which is used to initialize the print dialog when the print dialog is opened for the PDF document. More...
void | setPrintScale (int print_scale) throws com.foxit.sdk.PDFException
| Set page scaling option to be selected when a print dialog is displayed for PDF document. More...
void | setReadingDirection (boolean is_left_to_right) throws com.foxit.sdk.PDFException
| Set the predominant reading direction for text. More...
void | setUIDisplayStatus (int pref, boolean value) throws com.foxit.sdk.PDFException
| Set UI display status of a specified viewer preference item type. More...
void | setViewArea (int box_type) throws com.foxit.sdk.PDFException
| Set the page boundary representing the area of a page to be displayed when viewing the document on the screen. More...
void | setViewClip (int box_type) throws com.foxit.sdk.PDFException
| Set the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. More...
Public Member Functions inherited from com.foxit.sdk.common.Base
synchronized void | delete ()
| Clean up related C++ resources immediately. More...

## Static Public Attributes
static final int | e_CenterWindow = 4
| A flag specifying whether to position the document's window in the center of the screen.
static final int | e_DisplayDocTitle = 5
| A flag specifying whether the window's title bar should display the document title taken from the "Title" entry of the document information dictionary. If false, the title bar should instead display the name of the PDF file containing the document.
static final int | e_FitWindow = 3
| A flag specifying whether to resize the document's window to fit the size of the first displayed page.
static final int | e_HideMenubar = 1
| A flag specifying whether to hide the viewer application's menu bar when the document is active.
static final int | e_HideToolbar = 0
| A flag specifying whether to hide the viewer application's tool bars when the document is active.
static final int | e_HideWindowUI = 2
| A flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed.
static final int | e_PrintScaleAppDefault = 1
| This means applications should use the current print scaling.
static final int | e_PrintScaleNone = 0
| This means the print dialog should reflect no page scaling.

## Detailed Description

Viewer preferences defines the way that a document is to be presented on the screen or in print. This class should be constructed by a valid PDF document object. This class offers functions to get/set different part of a PDF document's viewer preferences, such as UI visibility, display mode for non full-screen mode, reading direction, the type of box item for specified purpose, some preference options used for print and so on.

See also
  PDFDoc

## Constructor & Destructor Documentation

## ◆ DocViewerPrefs() [1/2]

com.foxit.sdk.pdf.DocViewerPrefs.DocViewerPrefs | ( | PDFDoc | document,
|  | PDFDictionary | pdf_dict
| ) |  | throws com.foxit.sdk.PDFException

Constructor, with parameters.

When input parameter pdf_dict is null, Foxit PDF SDK will try to access viewer preferences information in the specified PDF document: if there exists viewer preferences information in the PDF document, this function is just to construct a document viewer preferences object to be associated with these information; if there is no such information in the specified PDF document, the constructed document viewer preferences object can be used to set these information to PDF document.

Parameters

  [in] | document | A valid PDF document object.
  [in] | pdf_dict | A PDF dictionary which represents PDF document viewer preferences information. If this parameter is not null, this PDF dictionary should have existed in the specified PDF document. If this parameter is null, that means to access access viewer preferences information in the specified PDF document. Please refer to "Details" part for more details. Default value: null.

## ◆ DocViewerPrefs() [2/2]

com.foxit.sdk.pdf.DocViewerPrefs.DocViewerPrefs | ( | DocViewerPrefs | other | ) |

Constructor, with another document viewer preferences object.

Parameters

  [in] | other | Another document viewer preferences object.

## Member Function Documentation

## ◆ delete()

synchronized void com.foxit.sdk.pdf.DocViewerPrefs.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

## ◆ getDict()

PDFDictionary com.foxit.sdk.pdf.DocViewerPrefs.getDict | ( |  | ) | throws com.foxit.sdk.PDFException

Get PDF dictionary from current object.

Returns
  The PDF dictionary. If there is any error, this function will return null.

## ◆ getNonFullScreenPageMode()

int com.foxit.sdk.pdf.DocViewerPrefs.getNonFullScreenPageMode | ( |  | ) | throws com.foxit.sdk.PDFException

Get display mode which specifies how to display the document on exiting full-screen mode when document's display mode is full-screen.

This display mode is only useful when document's display mode is full-screen. Function PDFDoc.getDisplayMode can be used to check document's displaying mode.

Returns
  Value of non full-screen mode. It would be one of following values:

  - com.foxit.sdk.pdf.PDFDoc.e_DisplayUseNone

  - com.foxit.sdk.pdf.PDFDoc.e_DisplayUseOutlines

  - com.foxit.sdk.pdf.PDFDoc.e_DisplayUseThumbs

  - com.foxit.sdk.pdf.PDFDoc.e_DisplayUseOC

## ◆ getPrintArea()

int com.foxit.sdk.pdf.DocViewerPrefs.getPrintArea | ( |  | ) | throws com.foxit.sdk.PDFException

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

Returns
  The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this would be one of these values.

## ◆ getPrintClip()

int com.foxit.sdk.pdf.DocViewerPrefs.getPrintClip | ( |  | ) | throws com.foxit.sdk.PDFException

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

Returns
  The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this would be one of these values.

## ◆ getPrintCopies()

int com.foxit.sdk.pdf.DocViewerPrefs.getPrintCopies | ( |  | ) | throws com.foxit.sdk.PDFException

Get the number of copies to be printed when the print dialog is opened for PDF document.

Returns
  The number of copies.

## ◆ getPrintRange()

Range com.foxit.sdk.pdf.DocViewerPrefs.getPrintRange | ( |  | ) | throws com.foxit.sdk.PDFException

Get page range information which is used to initialize the print dialog when the print dialog is opened for the PDF document.

All the indexes specified in the page range is from 0 to (pagecount - 1). If page range information is invalid, this function will throw exception com.foxit.sdk.common.Constants.e_ErrFormat .

Returns
  Page range.

## ◆ getPrintScale()

int com.foxit.sdk.pdf.DocViewerPrefs.getPrintScale | ( |  | ) | throws com.foxit.sdk.PDFException

Get page scaling option to be selected when a print dialog is displayed for PDF document.

Returns
  Page scaling option string value. Please refer to values starting from com.foxit.sdk.pdf.DocViewerPrefs.e_PrintScaleNone and this would be one of these values.

## ◆ getReadingDirection()

boolean com.foxit.sdk.pdf.DocViewerPrefs.getReadingDirection | ( |  | ) | throws com.foxit.sdk.PDFException

Get the predominant reading direction for text.

The reading direction information 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 (that is, multiple PDF pages are printed on a single page).

Returns
  true means left-to-right reading order, while false means right-to-left reading order.

## ◆ getUIDisplayStatus()

boolean com.foxit.sdk.pdf.DocViewerPrefs.getUIDisplayStatus | ( | int | pref | ) | throws com.foxit.sdk.PDFException

Get UI display status of a specified viewer preference item type.

Parameters

  [in] | pref | A viewer preference item type. Please refer to values starting from com.foxit.sdk.pdf.DocViewerPrefs.e_HideToolbar and this should be one of these values.

Returns
  The value of the specified viewer preference item type.

## ◆ getViewArea()

int com.foxit.sdk.pdf.DocViewerPrefs.getViewArea | ( |  | ) | throws com.foxit.sdk.PDFException

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

Returns
  The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this would be one of these values.

## ◆ getViewClip()

int com.foxit.sdk.pdf.DocViewerPrefs.getViewClip | ( |  | ) | throws com.foxit.sdk.PDFException

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

Returns
  The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this would be one of these values.

## ◆ isEmpty()

boolean com.foxit.sdk.pdf.DocViewerPrefs.isEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ setNonFullScreenPageMode()

void com.foxit.sdk.pdf.DocViewerPrefs.setNonFullScreenPageMode | ( | int | display_mode | ) | throws com.foxit.sdk.PDFException

Set display mode which specifies how to display the document on exiting full-screen mode when document's display mode is full-screen.

This display mode is only useful when document's display mode is full-screen. Function PDFDoc.getDisplayMode can be used to document's displaying mode.

Parameters

  [in] | display_mode | New display mode when exiting full-screen mode. It should be one of following values: com.foxit.sdk.pdf.PDFDoc.e_DisplayUseNone com.foxit.sdk.pdf.PDFDoc.e_DisplayUseOutlines com.foxit.sdk.pdf.PDFDoc.e_DisplayUseThumbs com.foxit.sdk.pdf.PDFDoc.e_DisplayUseOC

Returns
  None.

## ◆ setPrintArea()

void com.foxit.sdk.pdf.DocViewerPrefs.setPrintArea | ( | int | box_type | ) | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | box_type | The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this should be one of these values.

Returns
  None.

## ◆ setPrintClip()

void com.foxit.sdk.pdf.DocViewerPrefs.setPrintClip | ( | int | box_type | ) | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | box_type | The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this should be one of these values.

Returns
  None.

## ◆ setPrintCopies()

void com.foxit.sdk.pdf.DocViewerPrefs.setPrintCopies | ( | int | print_copies | ) | throws com.foxit.sdk.PDFException

Set the number of copies to be printed when the print dialog is opened for PDF document.

Parameters

  [in] | print_copies | New integer value for number of copies. Valid range: from 1 to 5. If input value is outside the valid range, Foxit PDF SDK will use 1 by default.

Returns
  None.

## ◆ setPrintRange()

void com.foxit.sdk.pdf.DocViewerPrefs.setPrintRange | ( | Range | page_range | ) | throws com.foxit.sdk.PDFException

Set the page range which is used to initialize the print dialog when the print dialog is opened for the PDF document.

Parameters

  [in] | page_range | A range object that represents the new page range information. It should contain at least one valid range segment. All the indexes specified by this range should be from 0 to (pagecount - 1). pagecount is returned by function PDFDoc.getPageCount .

Returns
  None.

## ◆ setPrintScale()

void com.foxit.sdk.pdf.DocViewerPrefs.setPrintScale | ( | int | print_scale | ) | throws com.foxit.sdk.PDFException

Set page scaling option to be selected when a print dialog is displayed for PDF document.

Parameters

  [in] | print_scale | New page scaling option string. Please refer to values starting from com.foxit.sdk.pdf.DocViewerPrefs.e_PrintScaleNone and this should be one of these values.

Returns
  None.

## ◆ setReadingDirection()

void com.foxit.sdk.pdf.DocViewerPrefs.setReadingDirection | ( | boolean | is_left_to_right | ) | throws com.foxit.sdk.PDFException

Set the predominant reading direction for text.

The reading direction information 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 (that is, multiple PDF pages are printed on a single page).

Parameters

  [in] | is_left_to_right | The new reading direction: true means left-to-right reading order, while false means right-to-left reading order.

Returns
  None.

## ◆ setUIDisplayStatus()

void com.foxit.sdk.pdf.DocViewerPrefs.setUIDisplayStatus | ( | int | pref,
|  | boolean | value
| ) |  | throws com.foxit.sdk.PDFException

Set UI display status of a specified viewer preference item type.

If the viewer preference item type does not existed before and has never been set, the value would be false by default.

Parameters

  [in] | pref | A viewer preference item type. Please refer to values starting from com.foxit.sdk.pdf.DocViewerPrefs.e_HideToolbar and this should be one of these values.
  [in] | value | The new value for the specified viewer preference item type.

Returns
  None.

## ◆ setViewArea()

void com.foxit.sdk.pdf.DocViewerPrefs.setViewArea | ( | int | box_type | ) | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | box_type | The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this should be one of these values.

Returns
  None.

## ◆ setViewClip()

void com.foxit.sdk.pdf.DocViewerPrefs.setViewClip | ( | int | box_type | ) | throws com.foxit.sdk.PDFException

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

Parameters

  [in] | box_type | The page box type. Please refer to values starting from com.foxit.sdk.pdf.PDFPage.e_MediaBox and this should be one of these values.

Returns
  None.