Foxit PDF SDK

Public Types | Public Member Functions | List of all members
foxit::pdf::DocViewerPrefs Class Reference
Inheritance diagram for foxit::pdf::DocViewerPrefs:

## Public Types
enum | PrintScale { e_PrintScaleNone = 0, e_PrintScaleAppDefault = 1 }
| Enumeration for page scaling option. More...
enum | ViewerPref { e_HideToolbar = 0, e_HideMenubar = 1, e_HideWindowUI = 2, e_FitWindow = 3, e_CenterWindow = 4, e_DisplayDocTitle = 5 }
| Enumeration for how various GUI elements should behave when the document is opened. More...

## Public Member Functions
| DocViewerPrefs (const DocViewerPrefs &other)
| Constructor, with another document viewer preferences object. More...
| DocViewerPrefs (const PDFDoc &document, objects::PDFDictionary *pdf_dict=0)
| Constructor, with parameters. More...
| ~DocViewerPrefs ()
| Destructor.
objects::PDFDictionary * | GetDict () const
| Get PDF dictionary from current object. More...
PDFDoc::DisplayMode | GetNonFullScreenPageMode () const
| Get display mode which specifies how to display the document on exiting full-screen mode when document's display mode is full-screen. More...
PDFPage::BoxType | GetPrintArea ()
| Get the page boundary representing the area of a page to be rendered when printing the document. More...
PDFPage::BoxType | GetPrintClip ()
| Get the page boundary to which the contents of a page are to be clipped when printing the document. More...
int | GetPrintCopies () const
| Get the number of copies to be printed when the print dialog is opened for PDF document. More...
common::Range | GetPrintRange () const
| Get page range information which is used to initialize the print dialog when the print dialog is opened for the PDF document. More...
PrintScale | GetPrintScale () const
| Get page scaling option to be selected when a print dialog is displayed for PDF document. More...
bool | GetReadingDirection () const
| Get the predominant reading direction for text. More...
bool | GetUIDisplayStatus (ViewerPref pref) const
| Get UI display status of a specified viewer preference item type. More...
PDFPage::BoxType | GetViewArea ()
| Get the page boundary representing the area of a page to be displayed when viewing the document on the screen. More...
PDFPage::BoxType | GetViewClip ()
| Get the page boundary to which the contents of a page are to be clipped when viewing the document on the screen. More...
bool | IsEmpty () const
| Check whether current object is empty or not. More...
bool | operator!= (const DocViewerPrefs &other) const
| Not equal operator. More...
DocViewerPrefs & | operator= (const DocViewerPrefs &other)
| Assign operator. More...
bool | operator== (const DocViewerPrefs &other) const
| Equal operator. More...
void | SetNonFullScreenPageMode (PDFDoc::DisplayMode display_mode)
| 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 (PDFPage::BoxType box_type)
| Set the page boundary representing the area of a page to be rendered when printing the document. More...
void | SetPrintClip (PDFPage::BoxType box_type)
| 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)
| Set the number of copies to be printed when the print dialog is opened for PDF document. More...
void | SetPrintRange (const common::Range &page_range)
| 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 (PrintScale print_scale)
| Set page scaling option to be selected when a print dialog is displayed for PDF document. More...
void | SetReadingDirection (bool is_left_to_right)
| Set the predominant reading direction for text. More...
void | SetUIDisplayStatus (ViewerPref pref, bool value)
| Set UI display status of a specified viewer preference item type. More...
void | SetViewArea (PDFPage::BoxType box_type)
| Set the page boundary representing the area of a page to be displayed when viewing the document on the screen. More...
void | SetViewClip (PDFPage::BoxType box_type)
| 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 foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## 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

## Member Enumeration Documentation

## ◆ PrintScale

enum foxit::pdf::DocViewerPrefs::PrintScale

Enumeration for page scaling option.

Values of this enumeration should be used alone.

Enumerator
e_PrintScaleNone | This means the print dialog should reflect no page scaling.
e_PrintScaleAppDefault | This means applications should use the current print scaling.

## ◆ ViewerPref

enum foxit::pdf::DocViewerPrefs::ViewerPref

Enumeration for how various GUI elements should behave when the document is opened.

Values of this enumeration should be used alone.

Enumerator
e_HideToolbar | A flag specifying whether to hide the viewer application's tool bars when the document is active.
e_HideMenubar | A flag specifying whether to hide the viewer application's menu bar when the document is active.
e_HideWindowUI | 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.
e_FitWindow | A flag specifying whether to resize the document's window to fit the size of the first displayed page.
e_CenterWindow | A flag specifying whether to position the document's window in the center of the screen.
e_DisplayDocTitle | 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.

## Constructor & Destructor Documentation

## ◆ DocViewerPrefs() [1/2]

foxit::pdf::DocViewerPrefs::DocViewerPrefs | ( | const PDFDoc & | document,
|  | objects::PDFDictionary * | pdf_dict = `0`
| ) |  |
| explicit

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]

foxit::pdf::DocViewerPrefs::DocViewerPrefs | ( | const DocViewerPrefs & | other | ) |

Constructor, with another document viewer preferences object.

Parameters

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

## Member Function Documentation

## ◆ GetDict()

objects::PDFDictionary* foxit::pdf::DocViewerPrefs::GetDict | ( |  | ) | const

Get PDF dictionary from current object.

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

## ◆ GetNonFullScreenPageMode()

PDFDoc::DisplayMode foxit::pdf::DocViewerPrefs::GetNonFullScreenPageMode | ( |  | ) | const

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:
  - PDFDoc::e_DisplayUseNone
  - PDFDoc::e_DisplayUseOutlines
  - PDFDoc::e_DisplayUseThumbs
  - PDFDoc::e_DisplayUseOC

## ◆ GetPrintArea()

PDFPage::BoxType foxit::pdf::DocViewerPrefs::GetPrintArea | ( |  | ) |

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 PDFPage::e_MediaBox and this would be one of these values.

## ◆ GetPrintClip()

PDFPage::BoxType foxit::pdf::DocViewerPrefs::GetPrintClip | ( |  | ) |

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 PDFPage::e_MediaBox and this would be one of these values.

## ◆ GetPrintCopies()

int foxit::pdf::DocViewerPrefs::GetPrintCopies | ( |  | ) | const

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

Returns
  The number of copies.

## ◆ GetPrintRange()

common::Range foxit::pdf::DocViewerPrefs::GetPrintRange | ( |  | ) | const

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 foxit::e_ErrFormat.

Returns
  Page range.

## ◆ GetPrintScale()

PrintScale foxit::pdf::DocViewerPrefs::GetPrintScale | ( |  | ) | const

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 DocViewerPrefs::e_PrintScaleNone and this would be one of these values.

## ◆ GetReadingDirection()

bool foxit::pdf::DocViewerPrefs::GetReadingDirection | ( |  | ) | const

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()

bool foxit::pdf::DocViewerPrefs::GetUIDisplayStatus | ( | ViewerPref | pref | ) | const

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 DocViewerPrefs::e_HideToolbar and this should be one of these values.

Returns
  The value of the specified viewer preference item type.

## ◆ GetViewArea()

PDFPage::BoxType foxit::pdf::DocViewerPrefs::GetViewArea | ( |  | ) |

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 PDFPage::e_MediaBox and this would be one of these values.

## ◆ GetViewClip()

PDFPage::BoxType foxit::pdf::DocViewerPrefs::GetViewClip | ( |  | ) |

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 PDFPage::e_MediaBox and this would be one of these values.

## ◆ IsEmpty()

bool foxit::pdf::DocViewerPrefs::IsEmpty | ( |  | ) | const

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.

## ◆ operator!=()

bool foxit::pdf::DocViewerPrefs::operator!= | ( | const DocViewerPrefs & | other | ) | const

Not equal operator.

Parameters

  [in] | other | Another document viewer preferences object. This function will check if current object is not equal to this one.

Returns
  true means not equal, while false means equal.

## ◆ operator=()

DocViewerPrefs& foxit::pdf::DocViewerPrefs::operator= | ( | const DocViewerPrefs & | other | ) |

Assign operator.

Parameters

  [in] | other | Another document viewer preferences object, whose value would be assigned to current object.

Returns
  Reference to current object itself.

## ◆ operator==()

bool foxit::pdf::DocViewerPrefs::operator== | ( | const DocViewerPrefs & | other | ) | const

Equal operator.

Parameters

  [in] | other | Another document viewer preferences object. This function will check if current object is equal to this one.

Returns
  true means equal, while false means not equal.

## ◆ SetNonFullScreenPageMode()

void foxit::pdf::DocViewerPrefs::SetNonFullScreenPageMode | ( | PDFDoc::DisplayMode | display_mode | ) |

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: PDFDoc::e_DisplayUseNone PDFDoc::e_DisplayUseOutlines PDFDoc::e_DisplayUseThumbs PDFDoc::e_DisplayUseOC

Returns
  None.

## ◆ SetPrintArea()

void foxit::pdf::DocViewerPrefs::SetPrintArea | ( | PDFPage::BoxType | box_type | ) |

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 PDFPage::e_MediaBox and this should be one of these values.

Returns
  None.

## ◆ SetPrintClip()

void foxit::pdf::DocViewerPrefs::SetPrintClip | ( | PDFPage::BoxType | box_type | ) |

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 PDFPage::e_MediaBox and this should be one of these values.

Returns
  None.

## ◆ SetPrintCopies()

void foxit::pdf::DocViewerPrefs::SetPrintCopies | ( | int | print_copies | ) |

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 foxit::pdf::DocViewerPrefs::SetPrintRange | ( | const common::Range & | page_range | ) |

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 foxit::pdf::DocViewerPrefs::SetPrintScale | ( | PrintScale | print_scale | ) |

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 DocViewerPrefs::e_PrintScaleNone and this should be one of these values.

Returns
  None.

## ◆ SetReadingDirection()

void foxit::pdf::DocViewerPrefs::SetReadingDirection | ( | bool | is_left_to_right | ) |

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 foxit::pdf::DocViewerPrefs::SetUIDisplayStatus | ( | ViewerPref | pref,
|  | bool | value
| ) |  |

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 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 foxit::pdf::DocViewerPrefs::SetViewArea | ( | PDFPage::BoxType | box_type | ) |

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 PDFPage::e_MediaBox and this should be one of these values.

Returns
  None.

## ◆ SetViewClip()

void foxit::pdf::DocViewerPrefs::SetViewClip | ( | PDFPage::BoxType | box_type | ) |

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 PDFPage::e_MediaBox and this should be one of these values.

Returns
  None.