SetaPDF_Core_Document_Page Class representing a PDF page

File: /SetaPDF v2/Core/Document/Page.php

Class hierarchy

Implements

Summary

Properties

$_additionalActions

$_annotations

$_canvas

The canvas object of this page

$_contents

The contents object for this page

$_inheritedAttributes

Inherited attributes

An array of SetaPDF_Core_Type_Dictionary_Entry instances

$_inheritedAttributesResolved

Flag for resolving of inherited attributes

$_pageIsObserved

protected boolean SetaPDF_Core_Document_Page::$_pageIsObserved = false

Flag for observing the page object

$_pageObject


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

Ensures that all inherited properties are resolved.

Exceptions

Throws SetaPDF_Core_Type_Exception

_ensureObservation()

Make sure that the page object is observed.

_getBoundary()

protected SetaPDF_Core_Document_Page::_getBoundary (
[ string $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, boolean $fallback = true [, boolean $asRect = true ]]]
): boolean|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array

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

cleanUp()

public SetaPDF_Core_Document_Page::cleanUp (
void
): void

Release memory/resources.

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.

getAnnotations()

Gets the annotation instance of this page.

getArtBox()

public SetaPDF_Core_Document_Page::getArtBox (
[ bool $fallback = true [, bool $asRect = true ]]
): bool|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array

Get the art box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 
Exceptions

Throws SetaPDF_Core_Type_Exception

getAttribute()

public SetaPDF_Core_Document_Page::getAttribute (
string $name [, bool $inherited = true ]
): SetaPDF_Core_Type_AbstractType|null

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

public SetaPDF_Core_Document_Page::getBleedBox (
[ bool $fallback = true [, bool $asRect = true ]]
): bool|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array

Get the bleed box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 
Exceptions

Throws SetaPDF_Core_Type_Exception

getBoundary()

public SetaPDF_Core_Document_Page::getBoundary (
[ string $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, boolean $fallback = true [, boolean $asRect = true ]]]
): boolean|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array

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

getCanvas()

Gets the canvas instance for this page.

getContents()

Gets the contents instance of this page.

getCropBox()

public SetaPDF_Core_Document_Page::getCropBox (
[ bool $fallback = true [, bool $asRect = true ]]
): bool|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array

Get the crop box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 
Exceptions

Throws SetaPDF_Core_Type_Exception

getDictionary()

Get the page dictionary.

Exceptions

Throws SetaPDF_Core_Type_Exception

getGroup()

Get a group attributes object.

Exceptions

Throws SetaPDF_Core_Type_Exception

getHeight()

public SetaPDF_Core_Document_Page::getHeight (
[ string $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, boolean $fallback = true ]]
): float|integer|boolean

Get the height of the page.

Parameters
$box : string
 
$fallback : boolean
 
Exceptions

Throws SetaPDF_Core_Type_Exception

getLastModified()

public SetaPDF_Core_Document_Page::getLastModified (
[ boolean $asString = true ]
): null|string|SetaPDF_Core_DataStructure_Date

Get the date and time the page was edited.

Parameters
$asString : boolean
 
Exceptions

Throws Exception

getMediaBox()

public SetaPDF_Core_Document_Page::getMediaBox (
[ bool $fallback = true [, bool $asRect = true ]]
): bool|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array

Get the media box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 
Exceptions

Throws SetaPDF_Core_Type_Exception

getMetadata()

public SetaPDF_Core_Document_Page::getMetadata (
void
): null|string

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

public SetaPDF_Core_Document_Page::getOrientation (
[ string $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, bool $fallback = true ]]
): bool|string

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
 

getRotation()

public SetaPDF_Core_Document_Page::getRotation (
void
): integer

Get the page rotation.

getStreamProxy()

Get the pages stream proxy object.

getTrimBox()

public SetaPDF_Core_Document_Page::getTrimBox (
[ bool $fallback = true [, bool $asRect = true ]]
): bool|SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array

Get the trim box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 
Exceptions

Throws SetaPDF_Core_Type_Exception

getWidth()

public SetaPDF_Core_Document_Page::getWidth (
[ string $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, boolean $fallback = true ]]
): float|integer|boolean

Get the width of the page.

Parameters
$box : string
 
$fallback : boolean
 
Exceptions

Throws SetaPDF_Core_Type_Exception

getWidthAndHeight()

public SetaPDF_Core_Document_Page::getWidthAndHeight (
[ string $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, boolean $fallback = true ]]
): array|boolean

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

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:

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

public SetaPDF_Core_Document_Page::setMetadata (
string $metadata
): void

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