setasign\SetaPDF2\Core\Document\Catalog

ViewerPreferences Class representing the access to the ViewerPreferences dictionary of a document

File: /SetaPDF v2/Core/Document/Catalog/ViewerPreferences.php
Old class name (alias): \SetaPDF_Core_Document_Catalog_ViewerPreferences

Class hierarchy

Summary

Constants

DIRECTION_L2R

public const string ViewerPreferences::DIRECTION_L2R = 'L2R'

Constant value for predominant reading order for text.

Left to right.

DIRECTION_R2L

public const string ViewerPreferences::DIRECTION_R2L = 'R2L'

Constant value for predominant reading order for text.

Right to left.

DUPLEX_FLIP_LONG_EDGE

public const string ViewerPreferences::DUPLEX_FLIP_LONG_EDGE = 'DuplexFlipLongEdge'

Constant value of the paper handling option that shall be used when printing the file from the print dialog.

Duplex and flip on the long edge of the sheet.

DUPLEX_FLIP_SHORT_EDGE

public const string ViewerPreferences::DUPLEX_FLIP_SHORT_EDGE = 'DuplexFlipShortEdge'

Constant value of the paper handling option that shall be used when printing the file from the print dialog.

Duplex and flip on the short edge of the sheet.

DUPLEX_SIMPLEX

public const string ViewerPreferences::DUPLEX_SIMPLEX = 'Simplex'

Constant value of the paper handling option that shall be used when printing the file from the print dialog.

Print single-sided.

NON_FULL_SCREEN_PAGE_MODE_USE_NONE

public const string ViewerPreferences::NON_FULL_SCREEN_PAGE_MODE_USE_NONE = 'UseNone'

Constant value specifying how to display the document on exiting full-screen mode.

Neither document outline nor thumbnail images visible.

NON_FULL_SCREEN_PAGE_MODE_USE_OC

Constant value specifying how to display the document on exiting full-screen mode.

Optional content group panel visible.

NON_FULL_SCREEN_PAGE_MODE_USE_OUTLINES

public const string ViewerPreferences::NON_FULL_SCREEN_PAGE_MODE_USE_OUTLINES = 'UseOutlines'

Constant value specifying how to display the document on exiting full-screen mode.

Document outline visible.

NON_FULL_SCREEN_PAGE_MODE_USE_THUMBS

public const string ViewerPreferences::NON_FULL_SCREEN_PAGE_MODE_USE_THUMBS = 'UseThumbs'

Constant value specifying how to display the document on exiting full-screen mode.

Thumbnail images visible.

PRINT_SCALING_APP_DEFAULT

public const string ViewerPreferences::PRINT_SCALING_APP_DEFAULT = 'AppDefault'

Constant value of the the page scaling option that shall be selected when a print dialog is displayed for this document.

Reader’s default print scaling.

PRINT_SCALING_NONE

public const string ViewerPreferences::PRINT_SCALING_NONE = 'None'

Constant value of the the page scaling option that shall be selected when a print dialog is displayed for this document.

No page scaling.


Properties

$_catalog


Methods

__construct()

The constructor.

Parameters
$catalog : \SetaPDF_Core_Document_Catalog
 

_getValue()

protected ViewerPreferences::_getValue (
string $key,
mixed $default = false,
bool $pdfObject = false
): mixed

Helper method to get a value of the ViewerPreferences dictionary.

Parameters
$key : string
 
$default : mixed
 
$pdfObject : bool
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

_removeKey()

protected ViewerPreferences::_removeKey (
string $key
): void

Helper method for removing a key from the ViewerPreferences dictionary.

Parameters
$key : string
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

_setBooleanValue()

protected ViewerPreferences::_setBooleanValue (
string $key,
bool $value
): void

Helper method for setting boolean values.

Parameters
$key : string
 
$value : bool
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

_setNameValue()

protected ViewerPreferences::_setNameValue (
string $key,
string $name
): void

Helper method for setting a name value.

Parameters
$key : string
 
$name : string
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

_setValue()

protected ViewerPreferences::_setValue (
string $key,
\SetaPDF_Core_Type_AbstractType $value
): void

Helper method for setting a value.

Parameters
$key : string
 
$value : \SetaPDF_Core_Type_AbstractType
 
Exceptions

Throws \setasign\SetaPDF2\Core\Type\Exception

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

cleanUp()

public ViewerPreferences::cleanUp (
void
): void

Release memory and cycled references.

getCenterWindow()

public ViewerPreferences::getCenterWindow (
void
): bool

Get the flag specifying whether to position the document’s window in the center of the screen.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getDirection()

public ViewerPreferences::getDirection (
void
): string

Get the predominant reading order for text.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getDisplayDocTitle()

public ViewerPreferences::getDisplayDocTitle (
void
): bool

Get the flag whether the title or the filename of the document should be displayed in the window’s title bar.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getDocument()

Get the document instance.

getDuplex()

public ViewerPreferences::getDuplex (
void
): ?string

Get the paper handling option that shall be used when printing the file from the print dialog.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getFitWindow()

public ViewerPreferences::getFitWindow (
void
): bool

Get the flag specifying whether to resize the document’s window to fit the size of the first displayed page.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getHideMenubar()

public ViewerPreferences::getHideMenubar (
void
): bool

Get the flag specifying whether to hide the conforming reader’s menu bar when the document is active.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getHideToolbar()

public ViewerPreferences::getHideToolbar (
void
): bool

Get the flag specifying whether to hide the conforming reader’s tool bars when the document is active.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getHideWindowUI()

public ViewerPreferences::getHideWindowUI (
void
): bool

Get 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.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getNonFullScreenPageMode()

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

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getNumCopies()

public ViewerPreferences::getNumCopies (
int $defaultValue = 1
): bool|mixed

Get the number of copies that shall be printed when the print dialog is opened.

Parameters
$defaultValue : int

A default value, to be used if no preference is defined.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getPickTrayByPdfSize()

public ViewerPreferences::getPickTrayByPdfSize (
?bool $defaultValue = null
): bool|mixed

Get the flag specifying whether the PDF page size shall be used to select the input paper tray.

Parameters
$defaultValue : ?bool
 
Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getPrintArea()

public ViewerPreferences::getPrintArea (
void
): string

Get the name of the page boundary representing the area of a page that shall be rendered when printing the document.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getPrintClip()

public ViewerPreferences::getPrintClip (
void
): string

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

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getPrintPageRange()

public ViewerPreferences::getPrintPageRange (
array $defaultValue = array ( )
): array

Get the page numbers used to initialize the print dialog box when the file is printed.

Parameters
$defaultValue : array

A default value that will be returned if no preference is defined.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getPrintScaling()

public ViewerPreferences::getPrintScaling (
void
): string

Get the page scaling option that shall be selected when a print dialog is displayed for this document.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getViewArea()

public ViewerPreferences::getViewArea (
void
): string

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

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

getViewClip()

public ViewerPreferences::getViewClip (
void
): string

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

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setCenterWindow()

public ViewerPreferences::setCenterWindow (
bool $value = true
): void

Set the flag specifying whether to position the document’s window in the center of the screen.

Parameters
$value : bool

A boolean value defining whether to position the document’s window in the center.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setDirection()

public ViewerPreferences::setDirection (
string|false $name
): void

Set the predominant reading order for text.

Parameters
$name : string|false

A constant value of ViewerPreferences::DIRECTION_XXX or false to remove this entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setDisplayDocTitle()

public ViewerPreferences::setDisplayDocTitle (
bool $value = true
): void

Set the flag whether the title or the filename of the document should be displayed in the window’s title bar.

Parameters
$value : bool

The value defining whether if the title of the document should be displayed in the window’s title bar (true) or the filename (false).

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setDuplex()

public ViewerPreferences::setDuplex (
string|false $name
): void

Set the paper handling option that shall be used when printing the file from the print dialog.

Parameters
$name : string|false

A constant value of ViewerPreferences::DUPLEX_XXX or false to remove that entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setFitWindow()

public ViewerPreferences::setFitWindow (
bool $value = true
): void

Set the flag specifying whether to resize the document’s window to fit the size of the first displayed page.

Parameters
$value : bool

A boolean value defining whether to resize the document’s window.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setHideMenubar()

public ViewerPreferences::setHideMenubar (
bool $value = true
): void

Set the flag specifying whether to hide the conforming reader’s menu bar when the document is active.

Does not affect the display through a browser plugin.

Parameters
$value : bool

A boolean value defining whether to hide the menu bar or not.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setHideToolbar()

public ViewerPreferences::setHideToolbar (
bool $value = true
): void

Set the flag specifying whether to hide the conforming reader’s tool bars when the document is active.

Parameters
$value : bool

A boolean value defining whether to hide the tool bars or not.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setHideWindowUI()

public ViewerPreferences::setHideWindowUI (
bool $value = true
): void

Set 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.

Parameters
$value : bool

A boolean value defining whether to hide user interface elements in the document's windows.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setNonFullScreenPageMode()

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

Parameters
$name : string|false

A constant value of ViewerPreferences::NON_FULL_SCREEN_PAGE_MODE_XXX or false to remove the entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setNumCopies()

public ViewerPreferences::setNumCopies (
int|false $numCopies
): void

Set the number of copies that shall be printed when the print dialog is opened for this file.

Parameters
$numCopies : int|false

The number of copies or false to remove this entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setPickTrayByPdfSize()

public ViewerPreferences::setPickTrayByPdfSize (
bool $value = true
): void

Set the flag specifying whether the PDF page size shall be used to select the input paper tray.

Parameters
$value : bool

A boolean value

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setPrintArea()

public ViewerPreferences::setPrintArea (
string|false $boundaryName
): void

Set the name of the page boundary representing the area of a page that shall be rendered when printing the document.

Parameters
$boundaryName : string|false

A boundary name as defined as a constant in \setasign\SetaPDF2\Core\PageBoundaries or false to remove that entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setPrintClip()

public ViewerPreferences::setPrintClip (
string|false $boundaryName
): void

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

Parameters
$boundaryName : string|false

A boundary name as defined as a constant in \setasign\SetaPDF2\Core\PageBoundaries or false to remove that entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setPrintPageRange()

public ViewerPreferences::setPrintPageRange (
?array $pageRange = null
): void

Set the page numbers used to initialize the print dialog box when the file is printed.

Parameters
$pageRange : ?array

An array of even number of integer values to be interpreted in pairs. Each pair represents the first and last pages in a sub-range of pages.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setPrintScaling()

public ViewerPreferences::setPrintScaling (
string|false $name
): void

Set the page scaling option that shall be selected when a print dialog is displayed for this document.

Parameters
$name : string|false

A constant value of ViewerPreferences::PRINT_SCALING_XXX or false to remove that entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setViewArea()

public ViewerPreferences::setViewArea (
string|false $boundaryName
): void

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

Parameters
$boundaryName : string|false

A boundary name as defined as a constant in \setasign\SetaPDF2\Core\PageBoundaries or false to remove this entry.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception

setViewClip()

public ViewerPreferences::setViewClip (
string $boundaryName
): void

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

Parameters
$boundaryName : string

A boundary name as defined as a constant in \setasign\SetaPDF2\Core\PageBoundaries.

Exceptions

Throws \setasign\SetaPDF2\Core\SecHandler\Exception

Throws \setasign\SetaPDF2\Core\Type\Exception