setasign\SetaPDF2\Core\Document
Page Class representing a PDF page
File: /SetaPDF v2/Core/Document/Page.php
Old class name (alias):
\SetaPDF_Core_Document_Page
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
$_canvas
The canvas object of this page
$_contents
The contents object for this page
$_inheritedAttributes
Inherited attributes
An array of \setasign\SetaPDF2\Core\Type\Dictionary\Entry instances
$_pageObject
The page indirect object
Static Methods
create()
Creates a new page for a specific document.
Parameters
- $document : \SetaPDF_Core_Document
- $values : array|\SetaPDF_Core_Type_Dictionary
Exceptions
Methods
__construct()
_checkBoundary()
Checks a boundary for validity.
Parameters
- $newBoundary : \SetaPDF_Core_DataStructure_Rectangle|\SetaPDF_Core_Type_Array
- $newBox : string
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \OutOfBoundsException
_getBoundary()
bool $fallback = true,
bool $asRect = true
Get a page boundary box of the page (wihtout logic for invalid values).
Parameters
- $box : string
See \setasign\SetaPDF2\Core\PageBoundaries::XXX_BOX constants
- $fallback : bool
Use the fallback box instead if box not exist
- $asRect : bool
Return boundary box as \setasign\SetaPDF2\Core\DataStructure\Rectangle
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
See
getArtBox()
bool $asRect = true
Get the art box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
getAttribute()
bool $inherited = true
Get an attribute of the page object or from an inherited pages object.
Parameters
- $name : string
- $inherited : bool
Exceptions
getBleedBox()
bool $asRect = true
Get the bleed box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
getBoundary()
bool $fallback = true,
bool $asRect = true
Get a page boundary box of the page.
To work with the boundary box it should be cloned and reset by the Page::setBoundary() method. This is necessary because a box could be inherited by a parent page tree node.
Parameters
- $box : string
See \setasign\SetaPDF2\Core\PageBoundaries::XXX_BOX constants
- $fallback : bool
Use the fallback box instead if box not exist
- $asRect : bool
Return boundary box as \setasign\SetaPDF2\Core\DataStructure\Rectangle
Exceptions
getCropBox()
bool $asRect = true
Get the crop box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
getHeight()
getLastModified()
Get the date and time the page was edited.
Parameters
- $asString : bool
Exceptions
Throws \Exception
getMediaBox()
bool $asRect = true
Get the media box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
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
getOrientation()
Get the orientation of the page.
Parameters
- $box : string
See \setasign\SetaPDF2\Core\PageBoundaries::XXX_BOX constants
- $fallback : bool
Use the fallback box instead if box not exist
Return Values
false or one of \setasign\SetaPDF2\Core\PageFormats::ORIENTATION_XXX constants
Exceptions
getTrimBox()
bool $asRect = true
Get the trim box of this page.
Parameters
- $fallback : bool
- $asRect : bool
Exceptions
getWidth()
getWidthAndHeight()
Get width and height of the page.
Parameters
- $box : string
- $fallback : bool
Return Values
array(width, height)
Exceptions
rotateBy()
Rotate a page by degrees.
Parameters
- $rotation : int
Degrees to rotate by
Return Values
Returns the Page object for method chaining.
Exceptions
setArtBox()
Set the art box.
Parameters
- $boundary : array|\SetaPDF_Core_Type_Dictionary_Entry|\SetaPDF_Core_Type_Array|\SetaPDF_Core_DataStructure_Rectangle
Exceptions
setBleedBox()
bool $checkBoundary = true
Set the bleed box.
Parameters
- $boundary : array|\SetaPDF_Core_Type_Dictionary_Entry|\SetaPDF_Core_Type_Array|\SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : bool
Ensure that boundary values are valid or not
Exceptions
setBoundary()
string $box = \setasign\SetaPDF2\Core\PageBoundaries::CROP_BOX,
bool $checkBoundary = true
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 \setasign\SetaPDF2\Core\DataStructure\Rectangle.
- An instance of \setasign\SetaPDF2\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 : bool
Ensure that boundary values are valid or not
Exceptions
Throws \InvalidArgumentException
setCropBox()
bool $checkBoundary = true
Set the crop box.
Parameters
- $boundary : array|\SetaPDF_Core_Type_Dictionary_Entry|\SetaPDF_Core_Type_Array|\SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : bool
Ensure that boundary values are valid or not
Exceptions
setGroup()
Set the group attributes object.
Parameters
- $group : false|\SetaPDF_Core_TransparencyGroup
Exceptions
Throws \InvalidArgumentException
setLastModified()
Set the date and time the page was edited.
Parameters
- $date : string|\SetaPDF_Core_DataStructure_Date
The last modification date. An instance of \setasign\SetaPDF2\Core\DataStructure\Date. Alternatively a string which is passed to its constructor.
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \Exception
setMediaBox()
bool $checkBoundary = true
Set the media box.
Parameters
- $boundary : array|\SetaPDF_Core_Type_Dictionary_Entry|\SetaPDF_Core_Type_Array|\SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : bool
Ensure that boundary values are valid or not
Exceptions
setMetadata()
Set the metadata stream.
To remove the metadata just pass null to this method.
Parameters
- $metadata : string
Exceptions
setRotation()
Set the page rotation.
Parameters
- $rotation : int
The rotation value
Return Values
Returns the Page object for method chaining.
Exceptions
Throws \InvalidArgumentException
setTrimBox()
bool $checkBoundary = true
Set the trim box.
Parameters
- $boundary : array|\SetaPDF_Core_Type_Dictionary_Entry|\SetaPDF_Core_Type_Array|\SetaPDF_Core_DataStructure_Rectangle
- $checkBoundary : bool
Ensure that boundary values are valid or not
Exceptions
toXObject()
Converts the page object into a form XObject.
Parameters
- $document : \SetaPDF_Core_Document
- $box : string
The name of the bounding box