SetaPDF_Core_Document_Page Class representing a PDF page
File: /SetaPDF v2/Core/Document/Page.php
Class hierarchy
Implements
Summary
Methods
- __construct()
- _checkBoundary()
- _ensureInheritedAttributes()
- _ensureObservation()
- _getBoundary()
- cleanUp()
- flattenInheritedAttributes()
- getAdditionalActions()
- getAnnotations()
- getArtBox()
- getAttribute()
- getBleedBox()
- getBoundary()
- getCanvas()
- getContents()
- getCropBox()
- getDictionary()
- getGroup()
- getHeight()
- getLastModified()
- getMediaBox()
- getMetadata()
- getObject()
- getOrientation()
- getPageObject()
- getRotation()
- getStreamProxy()
- getTrimBox()
- getWidth()
- getWidthAndHeight()
- rotateBy()
- setArtBox()
- setBleedBox()
- setBoundary()
- setCropBox()
- setGroup()
- setLastModified()
- setMediaBox()
- setMetadata()
- setRotation()
- setTrimBox()
- toXObject()
Properties
$_additionalActions
The additional actions object of this page
Static Methods
create()
Creates a new page for a specific document.
Parameters
- $document : SetaPDF_Core_Document
- $values : array|SetaPDF_Core_Type_Dictionary
Exceptions
Throws SetaPDF_Core_Exception
Methods
__construct()
The constructor.
Parameters
- $pageObject : SetaPDF_Core_Type_IndirectObject
Exceptions
Throws SetaPDF_Core_Type_Exception
_checkBoundary()
Checks a boundary for validity.
Parameters
- $newBoundary : SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array
- $newBox : string
Exceptions
Throws SetaPDF_Core_Type_Exception
Throws OutOfBoundsException
_ensureInheritedAttributes()
_getBoundary()
Get a page boundary box of the page (wihtout logic for invalid values).
Parameters
- $box : string
See
SetaPDF_Core_PageBoundaries::XXX_BOX
constants- $fallback : boolean
Use the fallback box instead if box not exist
- $asRect : boolean
Return boundary box as
SetaPDF_Core_DataStructure_Rectangle
Exceptions
Throws SetaPDF_Core_Type_Exception
See
flattenInheritedAttributes()
Flattens the inherited attributes to the main page object.
Exceptions
Throws SetaPDF_Core_Type_Exception
getAdditionalActions()
Gets the additional actions object instance for this page.
getArtBox()
Get the art box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
Throws SetaPDF_Core_Type_Exception
getAttribute()
Get an attribute of the page object or from an inherited pages object.
Parameters
- $name : string
- $inherited : bool
Exceptions
Throws SetaPDF_Core_Type_Exception
getBleedBox()
Get the bleed box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
Throws SetaPDF_Core_Type_Exception
getBoundary()
Get a page boundary box of the page.
To work with the boundary box it should be cloned and reset by the
SetaPDF_Core_Document_Page::setBoundary()
method. This is
necessary because a box could be inherited by a parent page tree node.
Parameters
- $box : string
See
SetaPDF_Core_PageBoundaries::XXX_BOX
constants- $fallback : boolean
Use the fallback box instead if box not exist
- $asRect : boolean
Return boundary box as
SetaPDF_Core_DataStructure_Rectangle
Exceptions
Throws SetaPDF_Core_Type_Exception
getCropBox()
Get the crop box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
Throws SetaPDF_Core_Type_Exception
getDictionary()
getGroup()
getHeight()
Get the height of the page.
Parameters
- $box : string
- $fallback : boolean
Exceptions
Throws SetaPDF_Core_Type_Exception
getLastModified()
Get the date and time the page was edited.
Parameters
- $asString : boolean
Exceptions
Throws Exception
getMediaBox()
Get the media box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
Throws SetaPDF_Core_Type_Exception
getMetadata()
Get the metadata stream of a page.
This is a method for low level access to the XMP stream data of a page.
Return Values
Null if no metadata are available.
A string if the desired structure is available.
Exceptions
Throws SetaPDF_Core_Type_Exception
getObject()
Get the page object.
Parameters
- $observe : bool
getOrientation()
Get the orientation of the page.
Parameters
- $box : string
See
SetaPDF_Core_PageBoundaries::XXX_BOX
constants- $fallback : bool
Use the fallback box instead if box not exist
Return Values
false or one of SetaPDF_Core_PageFormats::ORIENTATION_XXX
constants
Exceptions
Throws SetaPDF_Core_Type_Exception
getPageObject()
Get the page indirect object.
Parameters
- $observe : boolean
getTrimBox()
Get the trim box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
Throws SetaPDF_Core_Type_Exception
getWidth()
Get the width of the page.
Parameters
- $box : string
- $fallback : boolean
Exceptions
Throws SetaPDF_Core_Type_Exception
getWidthAndHeight()
Get width and height of the page.
Parameters
- $box : string
- $fallback : boolean
Return Values
array(width, height)
Exceptions
Throws SetaPDF_Core_Type_Exception
rotateBy()
Rotate a page by degrees.
Parameters
- $rotation : integer
Degrees to rotate by
Return Values
Returns the SetaPDF_Core_Document_Page object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setArtBox()
Set the art box.
Parameters
- $boundary : array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setBleedBox()
Set the bleed box.
Parameters
- $boundary : array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : boolean
Ensure that boundary values are valid or not
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setBoundary()
Set a boundary box.
A boundary consists of four numeric values: llx, lly, urx and ury. They can be passed in various ways:
- By a simple PHP array.
- A PDF Array with 4 numeric values.
- An instance of
SetaPDF_Core_DataStructure_Rectangle
. -
An instance of
SetaPDF_Core_Type_Dictionary_Entry
where the key defines the box and the value the boundary itself.
Parameters
- $boundary : array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle
- $box : string
The page boundary name
- $checkBoundary : boolean
Ensure that boundary values are valid or not
Exceptions
Throws InvalidArgumentException
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setCropBox()
Set the crop box.
Parameters
- $boundary : array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : boolean
Ensure that boundary values are valid or not
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setGroup()
Set the group attributes object.
Parameters
- $group : false|SetaPDF_Core_TransparencyGroup
Exceptions
Throws InvalidArgumentException
Throws SetaPDF_Core_Type_Exception
setLastModified()
Set the date and time the page was edited.
Parameters
- $date : string|SetaPDF_Core_DataStructure_Date
The last modification date. An instance of
SetaPDF_Core_DataStructure_Date
. Alternatively a string which is passed to its constructor.
Exceptions
Throws SetaPDF_Core_Type_Exception
Throws Exception
setMediaBox()
Set the media box.
Parameters
- $boundary : array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : boolean
Ensure that boundary values are valid or not
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setMetadata()
Set the metadata stream.
To remove the metadata just pass null to this method.
Parameters
- $metadata : string
Exceptions
Throws SetaPDF_Core_Type_Exception
setRotation()
Set the page rotation.
Parameters
- $rotation : integer
The rotation value
Return Values
Returns the SetaPDF_Core_Document_Page object for method chaining.
Exceptions
Throws InvalidArgumentException
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setTrimBox()
Set the trim box.
Parameters
- $boundary : array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : boolean
Ensure that boundary values are valid or not
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
toXObject()
Converts the page object into a form XObject.
Parameters
- $document : SetaPDF_Core_Document
- $box : string
The name of the bounding box
Exceptions
Throws SetaPDF_Exception_NotImplemented
Throws SetaPDF_Core_Type_Exception