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)
category | Zend |
---|---|
package | Zend_Pdf |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
__construct(string $source= null
, integer $revision= null
, boolean $load= false
) : \Zend_Pdf
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 - current version, 1 - previous version, 2 - ...)
string
integer
boolean
\Zend_Pdf_Exception |
---|
\Zend_Pdf
addJavaScript(string|array $javaScript)
string
array
\Zend_Pdf_Exception |
---|
extractFont(string $fontName) : \Zend_Pdf_Resource_Font_Extracted | null
$fontName should be specified in UTF-8 encoding
string
\Zend_Pdf_Exception |
---|
\Zend_Pdf_Resource_Font_Extracted
null
extractFonts() : array
returns array of Zend_Pdf_Resource_Font_Extracted objects
\Zend_Pdf_Exception |
---|
array
getJavaScript() : string
string
getMemoryManager() : \Zend_Memory_Manager
\Zend_Memory_Manager
getMetadata() : string
string
getNamedDestination(string $name) : \Zend_Pdf_Destination_Explicit | \Zend_Pdf_Action_GoTo
string
\Zend_Pdf_Destination_Explicit
\Zend_Pdf_Action_GoTo
getNamedDestinations() : array
Named targets can be used to reference from outside the PDF, ex: 'http://www.something.com/mydocument.pdf#MyAction'
array
getOpenAction() : \Zend_Pdf_Target
\Zend_Pdf_Target
getTextFieldNames() : array
array
of stringsload(string $source= null
, integer $revision= null
) : \Zend_Pdf
string
integer
\Zend_Pdf
markTextFieldAsReadOnly(string $name)
string
newPage(mixed $param1, mixed $param2 = null
) : \Zend_Pdf_Page
Method signatures:
mixed
mixed
\Zend_Pdf_Page
parse(string $source= null
, integer $revision= null
) : \Zend_Pdf
string
integer
\Zend_Pdf
pdfDate(integer $timestamp = null
) : string
todo | This really isn't the best location for this method. It should probably actually exist as Zend_Pdf_Element_Date or something like that. |
---|---|
todo | Address the following E_STRICT issue: PHP Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. |
integer
(optional) If omitted, uses the current time.
string
render(boolean $newSegmentOnly= false
, resource $outputStream= null
) : string
If $newSegmentOnly is true and it's not a new document, then only appended part of PDF is returned.
boolean
resource
\Zend_Pdf_Exception |
---|
string
resetJavaScript()
resolveDestination(\Zend_Pdf_Destination $destination, boolean $refreshPageCollectionHashes = true
) : \Zend_Pdf_Page | null
Returns Zend_Pdf_Page page object or null if destination is not found within PDF document.
\Zend_Pdf_Destination
Destination to resolve
boolean
Refresh page collection hashes before processing
\Zend_Pdf_Exception |
---|
\Zend_Pdf_Page
null
revisions() : integer
integer
rollback(integer $steps)
This method must be invoked before any changes, applied to the document. Otherwise behavior is undefined.
integer
save(string $filename, boolean $updateOnly = false
)
If $updateOnly is true and it's not a new document, then it only appends new section to the end of file.
string
boolean
\Zend_Pdf_Exception |
---|
setJavaScript(string|array $javaScript)
Resets and appends
string
array
setMemoryManager(\Zend_Memory_Manager $memoryManager)
\Zend_Memory_Manager
setMetadata(string $metadata)
string
setNamedDestination(string $name, \Zend_Pdf_Destination_Explicit|\Zend_Pdf_Action_GoTo $destination = null
)
string
\Zend_Pdf_Destination_Explicit
\Zend_Pdf_Action_GoTo
\Zend_Pdf_Exception |
---|
setOpenAction(\Zend_Pdf_Target $openAction = null
)
returns | Zend_Pdf |
---|
\Zend_Pdf_Target
setTextField(string $name, string $value)
string
Name of textfield
string
Value
\Zend_Pdf_Exception |
if the textfield does not exist in the pdf |
---|
setTextFieldProperties(string $name, mixed $bitmask)
string
mixed
\Zend_Pdf_Exception |
---|
_cleanUpAction(\Zend_Pdf_Action $action, boolean $refreshPageCollectionHashes = true
) : \Zend_Pdf_Action | null
Returns null if root node is deleted or updated action overwise.
todo | Give appropriate name and make method public |
---|
\Zend_Pdf_Action
boolean
Refresh page collection hashes before processing
\Zend_Pdf_Action
null
_dumpNamedDestinations()
todo | Create a balanced tree instead of plain structure. |
---|
_dumpOutlines()
_dumpPages()
todo | atomatically attach page to the document, if it's not done yet. |
---|---|
todo | check, that page is attached to the current document |
todo | Dump pages as a balanced tree instead of a plain set. |
_loadFormFields(\Zend_Pdf_Element_Reference $root)
Populates the _formFields array, for later lookup of fields by name
\Zend_Pdf_Element_Reference
Document catalog entry
_loadJavaScript(\Zend_Pdf_Element_Reference $root)
Populates the _javaScript string, for later use of getJavaScript method.
\Zend_Pdf_Element_Reference
Document catalog entry
_loadNamedDestinations(\Zend_Pdf_Element_Reference $root, string $pdfHeaderVersion)
\Zend_Pdf_Element_Reference
Document catalog entry
string
\Zend_Pdf_Exception |
---|
_loadOutlines(\Zend_Pdf_Element_Reference $root)
\Zend_Pdf_Element_Reference
Document catalog entry
\Zend_Pdf_Exception |
---|
_loadPages(\Zend_Pdf_Element_Reference $pages, array|null $attributes = array()
)
\Zend_Pdf_Element_Reference
array
null
\Zend_Pdf_Exception |
---|
_refreshPagesHash() : \Zend_Pdf
\Zend_Pdf
$outlines : array
array()
$pages : array
array()
todo | implement it as a class, which supports ArrayAccess and Iterator interfaces, to provide incremental parsing and pages tree updating. That will give good performance and memory (PDF size) benefits. |
---|
$properties : array
array()
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)
$_formFields : array
array()
$_inheritableAttributes : array
array('Resources', 'MediaBox', 'CropBox', 'Rotate')
$_isNewDocument : boolean
true
$_javaScript : string
null
$_memoryManager : \Zend_Memory_Manager | null
null
$_namedTargets : array
array()
.." actions, used to refer document parts from outside PDF
$_objFactory : \Zend_Pdf_ElementFactory_Interface
null
$_originalOpenOutlinesCount : integer
0
$_originalOutlines : array
array()
$_originalProperties : array
array()
Used for tracking properties changes
$_pageNumbers : array
null
$_pageReferences : \SplObjectStorage
null
$_parser : \Zend_Pdf_Parser
It's not used, but has to be destroyed only with Zend_Pdf object
$_trailer : \Zend_Pdf_Trailer
null
PDF_FORM_FIELD_NOEXPORT = 4
PDF_FORM_FIELD_READONLY = 1
PDF_FORM_FIELD_REQUIRED = 2
PDF_HEADER = "%PDF-1.4\n%\xE2\xE3\xCF\xD3\n"
PDF_VERSION = '1.4'