SetaPDF_Core_Document_Destination Class for handling Destinations in a PDF document
File: /SetaPDF v2/Core/Document/Destination.php
Class hierarchy
Summary
Constants
FIT_MODE_FIT
Fit mode constant.
Display the page designated by page, with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension.See
- PDF 32000-1:2008 - Table 151
FIT_MODE_FIT_B
Fit mode constant.
Display the page designated by page, with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the bounding box within the window in the other dimension.See
- PDF 32000-1:2008 - Table 151
FIT_MODE_FIT_BH
Fit mode constant.
Display the page designated by page, with the vertical coordinate top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. A null value for top specifies that the current value of that parameter shall be retained unchanged.See
- PDF 32000-1:2008 - Table 151
FIT_MODE_FIT_BV
Fit mode constant.
Display the page designated by page, with the horizontal coordinate left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of its bounding box within the window. A null value for left specifies that the current value of that parameter shall be retained unchanged.See
- PDF 32000-1:2008 - Table 151
FIT_MODE_FIT_H
Fit mode constant.
Display the page designated by page, with the vertical coordinate toppositioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window. A null value for top specifies that the current value of that parameter shall be retained unchanged.See
- PDF 32000-1:2008 - Table 151
FIT_MODE_FIT_R
Fit mode constant.
Display the page designated by page, with its contents magnified just enough to fit the rectangle specified by the coordinates left, bottom, right, and top entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension.See
- PDF 32000-1:2008 - Table 151
FIT_MODE_FIT_V
Fit mode constant.
Display the page designated by page, with the horizontal coordinate left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window. A null value for left specifies that the current value of that parameter shall be retained unchanged.See
- PDF 32000-1:2008 - Table 151
FIT_MODE_XYZ
Fit mode constant.
Display the page designated by page, with the coordinates (left, top) positioned at the upper-left corner of the window and the contents of the page magnified by the factor zoom. A null value for any of the parameters left, top, or zoom specifies that the current value of that parameter shall be retained unchanged. A zoom value of 0 has the same meaning as a null value.See
- PDF 32000-1:2008 - Table 151
Properties
Static Methods
_handleFitModeParameter()
Handle the fitMode parameter and set the correct values in the resulting array.
Parameters
- $array : SetaPDF_Core_Type_Array
- $fitMode : string
createByPage()
Creates a destination by a page object.
All additional arguments are passed to the createDestinationArray() method.
Parameters
- $page : SetaPDF_Core_Document_Page
See
createByPageNo()
Creates a destination by page number.
All additional arguments are passed to the createDestinationArray() method.
Example:
$destinationArray = SetaPDF_Core_Document_Destination::createByPageNo( $document, 123, SetaPDF_Core_Document_Destination::FIT_MODE_XYZ, 30, 50, 200 );
Parameters
- $document : SetaPDF_Core_Document
- $pageNumber : int
Exceptions
Throws SetaPDF_Core_Exception
Throws SetaPDF_Core_Type_Exception
See
createDestinationArray()
Creates an explicit Destination array.
This method allows you to pass a flexible argument count after the $fitMode
parameter, depending on its value.
Following fit modes expect following arguments:
SetaPDF_Core_Document_Destination::FIT_MODE_XYZ
float|null $left, float|null $top, float|null $zoom
SetaPDF_Core_Document_Destination::FIT_MODE_FIT
- no parameter -
SetaPDF_Core_Document_Destination::FIT_MODE_FIT_H
float|null $top
SetaPDF_Core_Document_Destination::FIT_MODE_FIT_V
float|null $left
SetaPDF_Core_Document_Destination::FIT_MODE_FIT_R
float $left, float $bottom, float $right, float $top
SetaPDF_Core_Document_Destination::FIT_MODE_FIT_B
- no parameter -
SetaPDF_Core_Document_Destination::FIT_MODE_FIT_BH
float|null $top
SetaPDF_Core_Document_Destination::FIT_MODE_FIT_BV
float|null $left
Example:
$destinationArray = SetaPDF_Core_Document_Destination::createDestinationArray( $indirectObject, SetaPDF_Core_Document_Destination::FIT_MODE_XYZ, 30, 50, 200 );
It is also possible to pass a single array to the $fitMode
parameter with all data:
$destinationArray = SetaPDF_Core_Document_Destination::createDestinationArray( $indirectObject, [SetaPDF_Core_Document_Destination::FIT_MODE_XYZ, 30, 50, 200] );
Parameters
- $pageObject : SetaPDF_Core_Type_IndirectObject|SetaPDF_Core_Type_Numeric
The indirect object of a page of or the page number for the usage in remote go-to actions.
- $fitMode : string|array
The fit mode or an array with the fit mode and all additional arguments
Exceptions
Throws InvalidArgumentException
findByName()
Find a destination by a name.
Parameters
- $document : SetaPDF_Core_Document
- $name : string
Return Values
The destination object or false if it was not found.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
Methods
__construct()
The constructor.
Parameters
- $destination : SetaPDF_Core_Type_AbstractType
Exceptions
Throws InvalidArgumentException
getFitMode()
Get the fit mode and its parameters.
Return Values
Index 0 is the fit mode, all other values are the individual parameters of the fit mode.
Exceptions
Throws SetaPDF_Core_Type_Exception
getIndirectObject()
Get the indirect object of this destination or creates it in the specific document context.
Parameters
- $document : SetaPDF_Core_Document
The document instance
getPage()
Get the target page object.
Parameters
- $document : SetaPDF_Core_Document
Exceptions
Throws SetaPDF_Core_Document_ObjectNotDefinedException
Throws SetaPDF_Core_Document_ObjectNotFoundException
Throws SetaPDF_Core_Exception
Throws SetaPDF_Core_Type_Exception
getPageNo()
Get the target page number.
Parameters
- $document : SetaPDF_Core_Document
Exceptions
Throws SetaPDF_Core_Document_ObjectNotDefinedException
Throws SetaPDF_Core_Document_ObjectNotFoundException
Throws SetaPDF_Core_Exception
Throws SetaPDF_Core_Type_Exception