Class Zend_Pdf

Description

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)

  • license: New BSD License
  • copyright: Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Pdf.php (line 95)


	
			
Class Constant Summary
 PDF_HEADER = "%PDF-1.4\n%\xE2\xE3\xCF\xD3\n"
 PDF_VERSION = 1.4
Variable Summary
 array $pages
Method Summary
 static Zend_Pdf load ([string $source = null], [integer $revision = null])
 static Zend_Pdf parse ([ &$source = null], [integer $revision = null], string $source)
 static string pdfDate ([integer $timestamp = null])
 Zend_Pdf __construct ([ &$source = null], [integer $revision = null], [ $load = false], string $source)
 string getJavaScript ()
 array getNamedActions ()
 Zend_Pdf_Page newPage (mixed $param1, [mixed $param2 = null])
 array properties ()
 string render ([boolean $newSegmentOnly = false])
 integer revisions ()
 void rollback (integer $steps)
 void save (string $filename, [boolean $updateOnly = false])
 void setJavaScript (string $javascript)
Variables
array $pages = array() (line 120)

Pages collection

  • var: - array of Zend_Pdf_Page object
  • access: public
  • 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.
Methods
static load (line 181)

Load PDF document from a file

  • access: public
static Zend_Pdf load ([string $source = null], [integer $revision = null])
  • string $source
  • integer $revision
static parse (line 169)

Create new PDF document from a $source string

  • access: public
static Zend_Pdf parse ([ &$source = null], [integer $revision = null], string $source)
  • string $source
  • integer $revision
  • &$source
static pdfDate (line 597)

Convert date to PDF format (it's close to ASN.1 (Abstract Syntax Notation One) defined in ISO/IEC 8824).

  • access: public
  • 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.
static string pdfDate ([integer $timestamp = null])
  • integer $timestamp: (optional) If omitted, uses the current time.
Constructor __construct (line 229)

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

  • access: public
  • throws: Zend_Pdf_Exception
Zend_Pdf __construct ([ &$source = null], [integer $revision = null], [ $load = false], string $source)
  • string $source: - PDF file to load
  • integer $revision
  • &$source
  • $load
getJavaScript (line 455)

Return the document-level JavaScript or null if there is no JavaScript for this document

  • access: public
string getJavaScript ()
getNamedActions (line 468)

Return an associative array containing all the named actions in the PDF.

Named actions (it's always "GoTo" actions) can be used to reference from outside the PDF, ex: 'http://www.something.com/mydocument.pdf#MyAction'

  • access: public
array getNamedActions ()
newPage (line 421)

Create page object, attached to the PDF document.

Method signatures:

  1. Create new page with a specified pagesize. If $factory is null then it will be created and page must be attached to the document to be included into output.
--------------------------------------------------------- new Zend_Pdf_Page(string $pagesize); ---------------------------------------------------------

2. Create new page with a specified pagesize (in default user space units). If $factory is null then it will be created and page must be attached to the document to be included into output. --------------------------------------------------------- new Zend_Pdf_Page(numeric $width, numeric $height); ---------------------------------------------------------

  • access: public
Zend_Pdf_Page newPage (mixed $param1, [mixed $param2 = null])
  • mixed $param1
  • mixed $param2
properties (line 443)

Return return the 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)

  • access: public
array properties ()
render (line 481)

Render the completed PDF to a string.

If $newSegmentOnly is true, then only appended part of PDF is returned.

  • access: public
string render ([boolean $newSegmentOnly = false])
  • boolean $newSegmentOnly
revisions (line 283)

Retrive number of revisions.

  • access: public
integer revisions ()
rollback (line 303)

Rollback document $steps number of revisions.

This method must be invoked before any changes, applied to the document. Otherwise behavior is undefined.

  • access: public
void rollback (integer $steps)
  • integer $steps
save (line 195)

Render PDF document and save it.

If $updateOnly is true, then it only appends new section to the end of file.

  • access: public
  • throws: Zend_Pdf_Exception
void save (string $filename, [boolean $updateOnly = false])
  • string $filename
  • boolean $updateOnly
setJavaScript (line 574)

Set the document-level JavaScript

  • access: public
void setJavaScript (string $javascript)
  • string $javascript
Class Constants
PDF_HEADER = "%PDF-1.4\n%\xE2\xE3\xCF\xD3\n" (line 107)

PDF file header.

PDF_VERSION = 1.4 (line 102)

Version number of generated PDF documents.

Documentation generated on Thu, 18 Jan 2007 09:57:46 -0800 by phpDocumentor 1.3.1