Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
General entity which describes PDF document.
It implements document abstraction with a document level operations.
Class is used to create new PDF document or load existing document. See details in a class constructor description
Class agregates document level properties and entities (pages, bookmarks, document level actions, attachments, form object, etc)
PDF_VERSION = '1.4'
Version number of generated PDF documents.
PDF_HEADER = '%PDF-1.4\n%\xE2\xE3\xCF\xD3\n'
PDF file header.
array $_inheritableAttributes = 'array'
List of inheritable attributesfor pages tree
string $_javaScript = 'null'
Document level javascript
Zend_Memory_Manager|null $_memoryManager = 'null'
Memory manager for stream objects
array $_namedTargets = 'array'
Document named destinations or "GoTo..." actions, used to refer document parts from outside PDF
Zend_Pdf_ElementFactory_Interface $_objFactory = 'null'
PDF objects factory.
integer $_originalOpenOutlinesCount = '0'
Original document outlines open elements count Used to track outlines update
array $_originalOutlines = 'array'
Original document outlines list Used to track outlines update
array $_originalProperties = 'array'
Original properties set.
Used for tracking properties changes
array $_pageNumbers = 'null'
Pages collection hash: <page number> => Zend_Pdf_Page
SplObjectStorage $_pageReferences = 'null'
Pages collection hash: <page dictionary object hash id> => Zend_Pdf_Page
Zend_Pdf_Parser $_parser = ''
Pdf file parser.
It's not used, but has to be destroyed only with Zend_Pdf object
Zend_Pdf_Trailer $_trailer = 'null'
Pdf trailer (last or just created)
array $outlines = 'array'
Document outlines
array $pages = 'array'
Pages collection
array $properties = 'array'
Document properties
It's an associative array with PDF meta information, values may be string, boolean or float. Returned array could be used directly to access, add, modify or remove document properties.
Standard document properties: Title (must be set for PDF/X documents), Author, Subject, Keywords (comma separated list), Creator (the name of the application, that created document, if it was converted from other format), Trapped (must be true, false or null, can not be null for PDF/X documents)
__construct(
string $source
=
null, integer $revision
=
null, $load
=
false
)
:
Zend_Pdf
Creates or loads PDF document.
If $source is null, then it creates a new document.
If $source is a string and $load is false, then it loads document from a binary string.
If $source is a string and $load is true, then it loads document from a file.
$revision used to roll back document to specified version (0 - currtent version, 1 - previous version, 2 - ...)
_cleanUpAction(
Zend_Pdf_Action $action, $refreshPageCollectionHashes
=
true
)
:
Zend_Pdf_Action|null
Walk through action and its chained actions tree and remove nodes if they are GoTo actions with an unresolved target.
Returns null if root node is deleted or updated action overwise.
_dumpNamedDestinations(
)
:
Dump named destinations
_dumpOutlines(
)
:
Dump outlines recursively
_dumpPages(
)
:
Orginize pages to tha pages tree structure.
_loadNamedDestinations(
Zend_Pdf_Element_Reference $root, string $pdfHeaderVersion
)
:
Load named destinations recursively
_loadOutlines(
Zend_Pdf_Element_Reference $root
)
:
Load outlines recursively
_loadPages(
Zend_Pdf_Element_Reference $pages, array|null $attributes
=
array
)
:
Load pages recursively
_refreshPagesHash(
)
:
Zend_Pdf
Refresh page collection hashes
extractFont(
$fontName
)
:
Zend_Pdf_Resource_Font_Extracted|null
Extract font attached to the page by specific font name
$fontName should be specified in UTF-8 encoding
extractFonts(
)
:
array
Extract fonts attached to the document
returns array of Zend_Pdf_Resource_Font_Extracted objects
getJavaScript(
)
:
string
Return the document-level JavaScript or null if there is no JavaScript for this document
getMemoryManager(
)
:
Zend_Memory_Manager
Request used memory manager
getMetadata(
)
:
string
Return the document-level Metadata or null Metadata stream is not presented
getNamedDestination(
string $name
)
:
Zend_Pdf_Destination_Explicit|Zend_Pdf_Action_GoTo
Return specified named destination
getNamedDestinations(
)
:
array
Return an associative array containing all the named destinations (or GoTo actions) in the PDF.
Named targets can be used to reference from outside the PDF, ex: 'http://www.something.com/mydocument.pdf#MyAction'
getOpenAction(
)
:
Zend_Pdf_Target
Get open Action Returns Zend_Pdf_Target (Zend_Pdf_Destination or Zend_Pdf_Action object)
load(
string $source
=
null, integer $revision
=
null
)
:
Zend_Pdf
Load PDF document from a file
newPage(
mixed $param1, mixed $param2
=
null
)
:
Zend_Pdf_Page
Create page object, attached to the PDF document.
Method signatures:
parse(
string $source
=
null, integer $revision
=
null
)
:
Zend_Pdf
Create new PDF document from a $source string
pdfDate(
integer $timestamp
=
null
)
:
string
Convert date to PDF format (it's close to ASN.1 (Abstract Syntax Notation One) defined in ISO/IEC 8824).
render(
boolean $newSegmentOnly
=
false, resource $outputStream
=
null
)
:
string
Render the completed PDF to a string.
If $newSegmentOnly is true, then only appended part of PDF is returned.
resolveDestination(
Zend_Pdf_Destination $destination, $refreshPageCollectionHashes
=
true
)
:
Zend_Pdf_Page|null
Resolve destination.
Returns Zend_Pdf_Page page object or null if destination is not found within PDF document.
revisions(
)
:
integer
Retrive number of revisions.
rollback(
integer $steps
)
:
Rollback document $steps number of revisions.
This method must be invoked before any changes, applied to the document. Otherwise behavior is undefined.
save(
string $filename, boolean $updateOnly
=
false
)
:
Render PDF document and save it.
If $updateOnly is true, then it only appends new section to the end of file.
setJavaScript(
string $javascript
)
:
Set the document-level JavaScript
setMemoryManager(
Zend_Memory_Manager $memoryManager
)
:
Set user defined memory manager
setMetadata(
string $metadata
)
:
Sets the document-level Metadata (mast be valid XMP document)
setNamedDestination(
string $name, $destination
=
null
)
:
Set specified named destination
setOpenAction(
Zend_Pdf_Target $openAction
=
null
)
:
Set open Action which is actually Zend_Pdf_Destination or Zend_Pdf_Action object