SetaPDF_Core_Document_Page Class representing a PDF page

File: /SetaPDF/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

protected array An array of SetaPDF_Core_Type_Dictionary_Entry instances SetaPDF_Core_Document_Page::$_inheritedAttributes = array()

Inherited attributes

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

static public SetaPDF_Core_Document_Page SetaPDF_Core_Document_Page::create ( SetaPDF_Core_Document $document [, array $values = array ( ) ] )

Creates a new page for a specific document.

Parameters
$document : SetaPDF_Core_Document
 
$values : array
 

Methods

__construct()

public SetaPDF_Core_Document_Page::__construct ( SetaPDF_Core_Type_IndirectObject $pageObject )

The constructor.

Parameters
$pageObject : SetaPDF_Core_Type_IndirectObject
 
Exceptions

Throws SetaPDF_Core_Exception

_checkBoundary()

private void SetaPDF_Core_Document_Page::_checkBoundary ( SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array $newBoundary, string $newBox )

Checks a boundary for validity.

Parameters
$newBoundary : SetaPDF_Core_DataStructure_Rectangle|SetaPDF_Core_Type_Array
 
$newBox : string
 
Exceptions

Throws OutOfBoundsException

_ensureInheritedAttributes()

protected void SetaPDF_Core_Document_Page::_ensureInheritedAttributes ( void )

Ensures that all inherited properties are resolved.

_ensureObservation()

protected void SetaPDF_Core_Document_Page::_ensureObservation ( void )

Make sure that the page object is observed.

cleanUp()

public void SetaPDF_Core_Document_Page::cleanUp ( void )

Release memory/resources.

flattenInheritedAttributes()

public void SetaPDF_Core_Document_Page::flattenInheritedAttributes ( void )

Flattens the inherited attributes to the main page object.

getAdditionalActions()

public SetaPDF_Core_Document_Page_AdditionalActions SetaPDF_Core_Document_Page::getAdditionalActions ( void )

Gets the additional actions object instance for this page.

getAnnotations()

public SetaPDF_Core_Document_Page_Annotations SetaPDF_Core_Document_Page::getAnnotations ( void )

Gets the annotation instance of this page.

getArtBox()

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

Get the art box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 

getAttribute()

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

Get an attribute of the page object or from an inherited pages object.

Parameters
$name : string
 
$inherited : bool
 

getBleedBox()

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

Get the bleed box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 

getBoundary()

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

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

getCanvas()

public SetaPDF_Core_Canvas SetaPDF_Core_Document_Page::getCanvas ( void )

Gets the canvas instance for this page.

getContents()

public SetaPDF_Core_Document_Page_Contents SetaPDF_Core_Document_Page::getContents ( void )

Gets the contents instance of this page.

getCropBox()

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

Get the crop box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 

getGroup()

public null|SetaPDF_Core_TransparencyGroup SetaPDF_Core_Document_Page::getGroup ( void )

Get a group attributes object.

getHeight()

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

Get the height of the page.

Parameters
$box : string
 
$fallback : boolean
 

getLastModified()

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

Get the date and time the page was edited.

Parameters
$asString : boolean
 

getMediaBox()

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

Get the media box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 

getObject()

public SetaPDF_Core_Type_IndirectObject SetaPDF_Core_Document_Page::getObject ( [ bool $observe = false ] )

Get the page object.

Parameters
$observe : bool
 

getPageObject()

public SetaPDF_Core_Type_IndirectObject SetaPDF_Core_Document_Page::getPageObject ( [ boolean $observe = false ] )

Get the page indirect object.

Parameters
$observe : boolean
 

getRotation()

public integer SetaPDF_Core_Document_Page::getRotation ( void )

Get the page rotation.

getStreamProxy()

public SetaPDF_Core_Document_Page_Contents SetaPDF_Core_Document_Page::getStreamProxy ( void )

Get the pages stream proxy object.

getTrimBox()

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

Get the trim box of this page.

Parameters
$fallback : bool
 
$asRect : bool
 

getWidth()

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

Get the width of the page.

Parameters
$box : string
 
$fallback : boolean
 

getWidthAndHeight()

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

Get width and height of the page.

Parameters
$box : string
 
$fallback : boolean
 
Return Values

array(width, height)

rotateBy()

public SetaPDF_Core_Document_Page SetaPDF_Core_Document_Page::rotateBy ( integer $rotation )

Rotate a page by degrees.

Parameters
$rotation : integer

Degrees to rotate by

Return Values

Returns the SetaPDF_Core_Document_Page object for method chaining.

setArtBox()

setBleedBox()

public void SetaPDF_Core_Document_Page::setBleedBox ( array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle $boundary [, boolean $checkBoundary = true ] )

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

setBoundary()

public void SetaPDF_Core_Document_Page::setBoundary ( array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle $boundary [, string $box = \SetaPDF_Core_PageBoundaries::CROP_BOX [, boolean $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:

Parameters
$boundary : array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle

The data of the boundary.

$box : string

The page boundary name

$checkBoundary : boolean

Ensure that boundary values are valid or not

Exceptions

Throws InvalidArgumentException

setCropBox()

public void SetaPDF_Core_Document_Page::setCropBox ( array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle $boundary [, boolean $checkBoundary = true ] )

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

setGroup()

public void SetaPDF_Core_Document_Page::setGroup ( false|SetaPDF_Core_TransparencyGroup $group )

Set the group attributes object.

Parameters
$group : false|SetaPDF_Core_TransparencyGroup
 
Exceptions

Throws InvalidArgumentException

setLastModified()

public void SetaPDF_Core_Document_Page::setLastModified ( string|SetaPDF_Core_DataStructure_Date $date )

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.

setMediaBox()

public void SetaPDF_Core_Document_Page::setMediaBox ( array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle $boundary [, boolean $checkBoundary = true ] )

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

setRotation()

public SetaPDF_Core_Document_Page SetaPDF_Core_Document_Page::setRotation ( integer $rotation )

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

setTrimBox()

public void SetaPDF_Core_Document_Page::setTrimBox ( array|SetaPDF_Core_Type_Dictionary_Entry|SetaPDF_Core_Type_Array|SetaPDF_Core_DataStructure_Rectangle $boundary [, boolean $checkBoundary = true ] )

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

toXObject()

public SetaPDF_Core_XObject_Form SetaPDF_Core_Document_Page::toXObject ( SetaPDF_Core_Document $document [, string $box = \SetaPDF_Core_PageBoundaries::CROP_BOX ] )

Converts the page object into a form XObject.

Parameters
$document : SetaPDF_Core_Document
 
$box : string

The name of the bounding box