PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Annotations

An annotation associates an object such as a note, sound, or movie with a location on a page of a PDF document, or provides a way to interact with the user by means of the mouse and keyboard.

All annotations are represented by Zend_Pdf_Annotation abstract class.

Annotation may be attached to a page using Zend_Pdf_Page::attachAnnotation(Zend_Pdf_Annotation $annotation) method.

Three types of annotations may be created by user now:

  • Zend_Pdf_Annotation_Link::create($x1, $y1, $x2, $y2, $target) where $target is an action object or a destination or string (which may be used in place of named destination object).

  • Zend_Pdf_Annotation_Text::create($x1, $y1, $x2, $y2, $text)

  • Zend_Pdf_Annotation_FileAttachment::create($x1, $y1, $x2, $y2, $fileSpecification)

A link annotation represents either a hypertext link to a destination elsewhere in the document or an action to be performed.

A text annotation represents a "sticky note" attached to a point in the PDF document.

A file attachment annotation contains a reference to a file.

The following methods are shared between all annotation types:

  • setLeft(float $left)

  • float getLeft()

  • setRight(float $right)

  • float getRight()

  • setTop(float $top)

  • float getTop()

  • setBottom(float $bottom)

  • float getBottom()

  • setText(string $text)

  • string getText()

Text annotation property is a text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation's contents in human-readable form.

Link annotation objects also provide two additional methods:

  • setDestination(Zend_Pdf_Target|string $target)

  • Zend_Pdf_Target getDestination()

Zend Framework