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

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

Creates a new page for a specific document.

Parameters
$document : SetaPDF_Core_Document
 
$values
 
Exceptions

Throws SetaPDF_Core_Exception


Methods

__construct()

The constructor.

Parameters
$pageObject : SetaPDF_Core_Type_IndirectObject
 
Exceptions

Throws SetaPDF_Core_Exception

_checkBoundary()

private SetaPDF_Core_Document_Page::_checkBoundary (
$newBoundary, $newBox
): void

Checks a boundary for validity.

Parameters
$newBoundary
 
$newBox
 
Exceptions

Throws OutOfBoundsException

_ensureInheritedAttributes()

Ensures that all inherited properties are resolved.

_ensureObservation()

Make sure that the page object is observed.

_getBoundary()

protected SetaPDF_Core_Document_Page::_getBoundary (
[ $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, $fallback = true [, $asRect = true ]]]
):

Get a page boundary box of the page (wihtout logic for invalid values).

Parameters
$box

See SetaPDF_Core_PageBoundaries::XXX_BOX constants

$fallback

Use the fallback box instead if box not exist

$asRect

Return boundary box as SetaPDF_Core_DataStructure_Rectangle

See

cleanUp()

public SetaPDF_Core_Document_Page::cleanUp (
void
): void

Release memory/resources.

flattenInheritedAttributes()

Flattens the inherited attributes to the main page object.

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 (
[ $fallback = true [, $asRect = true ]]
):

Get the art box of this page.

Parameters
$fallback
 
$asRect
 

getAttribute()

public SetaPDF_Core_Document_Page::getAttribute (
$name [, $inherited = true ]
):

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

Parameters
$name
 
$inherited
 

getBleedBox()

public SetaPDF_Core_Document_Page::getBleedBox (
[ $fallback = true [, $asRect = true ]]
):

Get the bleed box of this page.

Parameters
$fallback
 
$asRect
 

getBoundary()

public SetaPDF_Core_Document_Page::getBoundary (
[ $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, $fallback = true [, $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

See SetaPDF_Core_PageBoundaries::XXX_BOX constants

$fallback

Use the fallback box instead if box not exist

$asRect

Return boundary box as SetaPDF_Core_DataStructure_Rectangle

getCanvas()

Gets the canvas instance for this page.

getContents()

Gets the contents instance of this page.

getCropBox()

public SetaPDF_Core_Document_Page::getCropBox (
[ $fallback = true [, $asRect = true ]]
):

Get the crop box of this page.

Parameters
$fallback
 
$asRect
 

getGroup()

Get a group attributes object.

getHeight()

public SetaPDF_Core_Document_Page::getHeight (
[ $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, $fallback = true ]]
):

Get the height of the page.

Parameters
$box
 
$fallback
 

getLastModified()

public SetaPDF_Core_Document_Page::getLastModified (
[ $asString = true ]
):

Get the date and time the page was edited.

Parameters
$asString
 

getMediaBox()

public SetaPDF_Core_Document_Page::getMediaBox (
[ $fallback = true [, $asRect = true ]]
):

Get the media box of this page.

Parameters
$fallback
 
$asRect
 

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.

getObject()

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

Get the page object.

Parameters
$observe
 

getOrientation()

Get the orientation of the page.

Parameters
$box

See SetaPDF_Core_PageBoundaries::XXX_BOX constants

$fallback

Use the fallback box instead if box not exist

Return Values

false or one of SetaPDF_Core_PageFormats::ORIENTATION_XXX constants

getPageObject()

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

Get the page indirect object.

Parameters
$observe
 

getRotation()

Get the page rotation.

getStreamProxy()

Get the pages stream proxy object.

getTrimBox()

public SetaPDF_Core_Document_Page::getTrimBox (
[ $fallback = true [, $asRect = true ]]
):

Get the trim box of this page.

Parameters
$fallback
 
$asRect
 

getWidth()

public SetaPDF_Core_Document_Page::getWidth (
[ $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, $fallback = true ]]
):

Get the width of the page.

Parameters
$box
 
$fallback
 

getWidthAndHeight()

Get width and height of the page.

Parameters
$box
 
$fallback
 
Return Values

array(width, height)

rotateBy()

public SetaPDF_Core_Document_Page::rotateBy (
$rotation
):

Rotate a page by degrees.

Parameters
$rotation

Degrees to rotate by

Return Values

Returns the SetaPDF_Core_Document_Page object for method chaining.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

setArtBox()

public SetaPDF_Core_Document_Page::setArtBox (
$boundary
): void

Set the art box.

Parameters
$boundary
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

setBleedBox()

public SetaPDF_Core_Document_Page::setBleedBox (
$boundary [, $checkBoundary = true ]
): void

Set the bleed box.

Parameters
$boundary
 
$checkBoundary

Ensure that boundary values are valid or not

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

setBoundary()

public SetaPDF_Core_Document_Page::setBoundary (
$boundary [, $box = SetaPDF_Core_PageBoundaries::CROP_BOX [, $checkBoundary = true ]]
): void

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
 
$box

The page boundary name

$checkBoundary

Ensure that boundary values are valid or not

Exceptions

Throws InvalidArgumentException

Throws SetaPDF_Core_SecHandler_Exception

setCropBox()

public SetaPDF_Core_Document_Page::setCropBox (
$boundary [, $checkBoundary = true ]
): void

Set the crop box.

Parameters
$boundary
 
$checkBoundary

Ensure that boundary values are valid or not

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

setGroup()

public SetaPDF_Core_Document_Page::setGroup (
$group
): void

Set the group attributes object.

Parameters
$group
 
Exceptions

Throws InvalidArgumentException

setLastModified()

Set the date and time the page was edited.

Parameters
$date

The last modification date. An instance of SetaPDF_Core_DataStructure_Date. Alternatively a string which is passed to its constructor.

setMediaBox()

public SetaPDF_Core_Document_Page::setMediaBox (
$boundary [, $checkBoundary = true ]
): void

Set the media box.

Parameters
$boundary
 
$checkBoundary

Ensure that boundary values are valid or not

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

setMetadata()

public SetaPDF_Core_Document_Page::setMetadata (
$metadata
): void

Set the metadata stream.

To remove the metadata just pass null to this method.

Parameters
$metadata
 

setRotation()

public SetaPDF_Core_Document_Page::setRotation (
$rotation
):

Set the page rotation.

Parameters
$rotation

The rotation value

Return Values

Returns the SetaPDF_Core_Document_Page object for method chaining.

Exceptions

Throws InvalidArgumentException

Throws SetaPDF_Core_SecHandler_Exception

setTrimBox()

public SetaPDF_Core_Document_Page::setTrimBox (
$boundary [, $checkBoundary = true ]
): void

Set the trim box.

Parameters
$boundary
 
$checkBoundary

Ensure that boundary values are valid or not

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

toXObject()

Converts the page object into a form XObject.

Parameters
$document : SetaPDF_Core_Document
 
$box

The name of the bounding box

Exceptions

Throws SetaPDF_Exception_NotImplemented