SetaPDF_Core_Document_Page_Annotation_Text Class representing a Text annotation

File: /SetaPDF/Core/Document/Page/Annotation/Text.php

See PDF 32000-1:2008 - 12.5.6.14

A text annotations icon will display a static predefined icon which will not resize if the document is zoomed. It will be aligned to the upper left corner of the Rect.

By setting the no rotate flag (SetaPDF_Core_Document_Page_Annotation::setNoRotateFlag) and the no-zoom flag (SetaPDF_Core_Document_Page_Annotation::setNoZoomFlag) the fixed size can be disabled and will allow you to define the size of the annotation your own. Anyhow the annotation is still not zoomable.

The aspect ratio of default icons are: Comment: 20 x 18 Key: 18 x 17 Note: 18 x 20 Help: 20 x 20 NewParagraph: 13 x 20 Paragraph: 11 x 20 Insert: 20 x 17

Class hierarchy

Summary

Constants

ICON_CHECK

Icon name supported by Adobe Acrobat

ICON_CIRCLE

Icon name supported by Adobe Acrobat

ICON_COMMENT

Icon name defined in PDF 32000-1:2008 - 12.5.6.4 Text Annotations

ICON_CROSS

Icon name supported by Adobe Acrobat

ICON_HELP

Icon name defined in PDF 32000-1:2008 - 12.5.6.4 Text Annotations

ICON_INSERT

Icon name defined in PDF 32000-1:2008 - 12.5.6.4 Text Annotations

ICON_KEY

Icon name defined in PDF 32000-1:2008 - 12.5.6.4 Text Annotations

ICON_NEW_PARAGRAPH

Icon name defined in PDF 32000-1:2008 - 12.5.6.4 Text Annotations

ICON_NOTE

Icon name defined in PDF 32000-1:2008 - 12.5.6.4 Text Annotations

ICON_PARAGRAPH

Icon name defined in PDF 32000-1:2008 - 12.5.6.4 Text Annotations

ICON_RIGHT_ARROW

Icon name supported by Adobe Acrobat

ICON_RIGHT_POINTER

Icon name supported by Adobe Acrobat

ICON_STAR

Icon name supported by Adobe Acrobat

ICON_UP_ARROW

Icon name supported by Adobe Acrobat

ICON_UP_LEFT_ARROW

Icon name supported by Adobe Acrobat

STATE_MODEL_MARKED

State model name

STATE_MODEL_MIGRATION_STATUS

State model name

STATE_MODEL_REVIEW

State model name


Properties

$_annotationDictionary


Static Methods

_createAnnotationDictionary()

static protected SetaPDF_Core_Type_Dictionary SetaPDF_Core_Document_Page_Annotation::_createAnnotationDictionary ( SetaPDF_Core_DataStructure_Rectangle|array $rect, string $subtype )

Creates an annotation dictionary with default values.

Parameters
$rect : SetaPDF_Core_DataStructure_Rectangle|array
 
$subtype : string
 

byObjectOrDictionary()

static public SetaPDF_Core_Document_Page_Annotation SetaPDF_Core_Document_Page_Annotation::byObjectOrDictionary ( SetaPDF_Core_Type_AbstractType|SetaPDF_Core_Type_Dictionary|SetaPDF_Core_Type_IndirectObjectInterface $objectOrDictionary )

Creates an annotation object by an annotation dictionary or its parent object.

Parameters
$objectOrDictionary : SetaPDF_Core_Type_AbstractType|SetaPDF_Core_Type_Dictionary|SetaPDF_Core_Type_IndirectObjectInterface
 
Exceptions

Throws InvalidArgumentException

createAnnotationDictionary()

static public SetaPDF_Core_Type_Dictionary SetaPDF_Core_Document_Page_Annotation_Text::createAnnotationDictionary ( SetaPDF_Core_DataStructure_Rectangle|array $rect )

Creates an text annotation dictionary.

Parameters
$rect : SetaPDF_Core_DataStructure_Rectangle|array
 
Exceptions

Throws InvalidArgumentException


Methods

__construct()

public SetaPDF_Core_Document_Page_Annotation_Text::__construct ( array|SetaPDF_Core_Type_AbstractType|SetaPDF_Core_Type_Dictionary|SetaPDF_Core_Type_IndirectObjectInterface $objectOrDictionary )

The constructor.

Parameters
$objectOrDictionary : array|SetaPDF_Core_Type_AbstractType|SetaPDF_Core_Type_Dictionary|SetaPDF_Core_Type_IndirectObjectInterface

The annotation dictionary or a rect value

Exceptions

Throws InvalidArgumentException

addReply()

public void SetaPDF_Core_Document_Page_Annotation_Markup::addReply ( SetaPDF_Core_Document_Page_Annotation_Markup $annotation )

Adds a reply to this annotation.

Parameters
$annotation : SetaPDF_Core_Document_Page_Annotation_Markup
 

cleanUp()

public void SetaPDF_Core_Document_Page_Annotation::cleanUp ( void )

Release memory/cycled references

createPopup()

public SetaPDF_Core_Document_Page_Annotation_Popup SetaPDF_Core_Document_Page_Annotation_Markup::createPopup ( [ int|float $offsetX = 30 [, int|float $offsetY = 20 [, int|float $width = 150 [, int|float $height = 100 ]]]] )

Create a popup annotation object for this annotation.

If the x-offset value is less than zero the popup will be created at the left side of the main annotation. Otherwise on the right side. If the y-offset value is less than zero the popup will be create down below the main annotation. Otherwise above.

You need to re-add this new popup annotation to its origin annotation by passing it to the addPopup() method after assigning it to the page object.

Parameters
$offsetX : int|float
 
$offsetY : int|float
 
$width : int|float
 
$height : int|float
 

getAdditionalActions()

public SetaPDF_Core_Document_Page_Annotation_AdditionalActions SetaPDF_Core_Document_Page_Annotation::getAdditionalActions ( void )

Gets the additional actions object instance for this annotation.

getAnnotationDictionary()

public SetaPDF_Core_Type_Dictionary SetaPDF_Core_Document_Page_Annotation::getAnnotationDictionary ( void )

Get the annotation dictionary.

getAppearance()

public null|SetaPDF_Core_XObject_Form SetaPDF_Core_Document_Page_Annotation::getAppearance ( [ string $type = 'N' [, null|string $subType = null ]] )

Get the annotation appearance stream.

Parameters
$type : string
 
$subType : null|string
 
Exceptions

Throws InvalidArgumentException

getColor()

public null|SetaPDF_Core_DataStructure_Color SetaPDF_Core_Document_Page_Annotation::getColor ( void )

Get the color of the annotation.

getContents()

public null|string SetaPDF_Core_Document_Page_Annotation::getContents ( [ string $encoding = 'UTF-8' ] )

Get the contents of the annotation.

Parameters
$encoding : string
 

getCreationDate()

public null|mixed|SetaPDF_Core_DataStructure_Date SetaPDF_Core_Document_Page_Annotation_Markup::getCreationDate ( [ bool $asString = true ] )

Get the creation date.

The date and time when the annotation was created.
Parameters
$asString : bool

Whether receive the value as a string (PDF date string) or as a SetaPDF_Core_DataStructure_Date instance.

See

getDictionary()

public SetaPDF_Core_Type_AbstractType|SetaPDF_Core_Type_Dictionary SetaPDF_Core_Document_Page_Annotation::getDictionary ( void )

Get the annotation dictionary.

getHeight()

public float|int SetaPDF_Core_Document_Page_Annotation::getHeight ( void )

Get the height of the annotation.

getHiddenFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getHiddenFlag ( void )

Checks for the "Hidden" flag.

PDF 32000-1:2008 - Table 165: "If set, do not display or print the annotation or allow it to interact with the user, regardless of its annotation type or whether an annotation handler is available."

getIconName()

public string SetaPDF_Core_Document_Page_Annotation_Text::getIconName ( void )

Get the icon name of the annotation.

getInReplyTo()

public null|SetaPDF_Core_Document_Page_Annotation SetaPDF_Core_Document_Page_Annotation_Markup::getInReplyTo ( void )

Get the in reply to annotation (if available).

See

getIndirectObject()

public SetaPDF_Core_Type_IndirectObject SetaPDF_Core_Document_Page_Annotation::getIndirectObject ( [ SetaPDF_Core_Document $document = null ] )

Get the indirect object of this annotation.

Parameters
$document : SetaPDF_Core_Document
 

getInvisibleFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getInvisibleFlag ( void )

Checks for the "Invisible" flag.

PDF 32000-1:2008 - Table 165: "If set, do not display the annotation if it does not belong to one of the standard annotation types and no annotation handler is available. If clear, display such an unknown annotation using an appearance stream specified by its appearance dictionary, if any"

getLockedContents()

public boolean SetaPDF_Core_Document_Page_Annotation::getLockedContents ( void )

Checks for the "LockedContents" flag.

PDF 32000-1:2008 - Table 165: "If set, do not allow the contents of the annotation to be modified by the user. This flag does not restrict deletion of the annotation or changes to other annotation properties, such as position and size."

getLockedFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getLockedFlag ( void )

Checks the "Locked" flag.

PDF 32000-1:2008 - Table 165: "If set, do not allow the annotation to be deleted or its properties (including position and size) to be modified by the user. However, this flag does not restrict changes to the annotation’s contents, such as the value of a form field."

getModificationDate()

public mixed|null|SetaPDF_Core_DataStructure_Date SetaPDF_Core_Document_Page_Annotation::getModificationDate ( [ bool $asString = true ] )

Get the modification date.

Parameters
$asString : bool
 

getName()

public mixed|null SetaPDF_Core_Document_Page_Annotation::getName ( [ string $encoding = 'UTF-8' ] )

Get the name of the annotation.

Parameters
$encoding : string
 

getNoRotateFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getNoRotateFlag ( void )

Checks fo the "NoRotate" flag.

PDF 32000-1:2008 - Table 165: "If set, do not rotate the annotation’s appearance to match the rotation of the page. The upper-left corner of the annotation rectangle shall remain in a fixed location on the page, regardless of the page rotation."

getNoViewFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getNoViewFlag ( void )

Checks for the "NoView" flag.

PDF 32000-1:2008 - Table 165: "If set, do not display the annotation on the screen or allow it to interact with the user. The annotation may be printed (depending on the setting of the Print flag) but should be considered hidden for purposes of on-screen display and user interaction."

getNoZoomFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getNoZoomFlag ( void )

Checks fo the "NoZoom" flag.

PDF 32000-1:2008 - Table 165: "If set, do not scale the annotation’s appearance to match the magnification of the page. The location of the annotation on the page (defined by the upper- left corner of its annotation rectangle) shall remain fixed, regardless of the page magnification."

getOpacity()

public float|mixed SetaPDF_Core_Document_Page_Annotation_Markup::getOpacity ( void )

Get the constant opacity value.

getPopup()

public null|SetaPDF_Core_Document_Page_Annotation_Popup SetaPDF_Core_Document_Page_Annotation_Markup::getPopup ( void )

Get the associated popup object if available.

getPrintFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getPrintFlag ( void )

Checks for the "Print" flag.

PDF 32000-1:2008 - Table 165: "If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of whether it is displayed on the screen."

getReadOnlyFlag()

public boolean SetaPDF_Core_Document_Page_Annotation::getReadOnlyFlag ( void )

Checks the "ReadOnly" flag.

PDF 32000-1:2008 - Table 165: "If set, do not allow the annotation to interact with the user. The annotation may be displayed or printed (depending on the settings of the NoView and Print flags) but should not respond to mouse clicks or change its appearance in response to mouse motions.

This flag shall be ignored for widget annotations; its function is subsumed by the ReadOnly flag of the associated form field"

getRect()

public SetaPDF_Core_DataStructure_Rectangle SetaPDF_Core_Document_Page_Annotation::getRect ( void )

Get the rectangle object of this annotation.

getReplies()

public array SetaPDF_Core_Document_Page_Annotation_Markup::getReplies ( SetaPDF_Core_Document_Page_Annotations $annotations )

Get all annotations which refer this annotation as an reply.

Parameters
$annotations : SetaPDF_Core_Document_Page_Annotations
 

getState()

public mixed|null SetaPDF_Core_Document_Page_Annotation_Text::getState ( void )

Get the annotation state.

See
  • PDF 32000-1:2008 - 12.5.6.3 Annotation States

getStateModel()

public mixed|null SetaPDF_Core_Document_Page_Annotation_Text::getStateModel ( void )

Get the state model.

See
  • PDF 32000-1:2008 - 12.5.6.3 Annotation States

getSubject()

public null|string SetaPDF_Core_Document_Page_Annotation_Markup::getSubject ( [ string $encoding = 'UTF-8' ] )

Get the subject.

Text representing a short description of the subject being addressed by the annotation.
Parameters
$encoding : string
 
See

getTextLabel()

public null|string SetaPDF_Core_Document_Page_Annotation_Markup::getTextLabel ( [ string $encoding = 'UTF-8' ] )

Get the text label.

The text label that shall be displayed in the title bar of the annotation’s pop-up window when open and active. This entry shall identify the user who added the annotation.
Parameters
$encoding : string
 
See

getToggleNoView()

public boolean SetaPDF_Core_Document_Page_Annotation::getToggleNoView ( void )

Checks for the "ToggleNoView" flag.

PDF 32000-1:2008 - Table 165: "If set, invert the interpretation of the NoView flag for certain events."

getType()

public string SetaPDF_Core_Document_Page_Annotation::getType ( void )

Get the action type specified in the S key.

getWidth()

public float|int SetaPDF_Core_Document_Page_Annotation::getWidth ( void )

Get the width of the annotation.

hasReplies()

public bool SetaPDF_Core_Document_Page_Annotation_Markup::hasReplies ( SetaPDF_Core_Document_Page_Annotations $annotations )

Check whether this annotation has a reply or not.

Parameters
$annotations : SetaPDF_Core_Document_Page_Annotations
 

isAnnotationFlagSet()

public boolean SetaPDF_Core_Document_Page_Annotation::isAnnotationFlagSet ( integer $flag )

Checks if a specific annotation flag is set.

Parameters
$flag : integer
 

isOpen()

public bool SetaPDF_Core_Document_Page_Annotation_Text::isOpen ( void )

Checks if the annotation shall initially be displayed open.

isReplyTo()

public bool SetaPDF_Core_Document_Page_Annotation_Markup::isReplyTo ( void )

Checks if this annotation is a reply to another annotation.

setAnnotationFlags()

public void SetaPDF_Core_Document_Page_Annotation::setAnnotationFlags ( integer $flags [, boolean $set = true ] )

Sets an annotation flag.

Parameters
$flags : integer
 
$set : boolean

Set or unset

setAppearance()

public void SetaPDF_Core_Document_Page_Annotation::setAppearance ( SetaPDF_Core_XObject_Form $xObject [, string $type = 'N' [, string|null $subState = null ]] )

Set the annotation appearance stream.

Parameters
$xObject : SetaPDF_Core_XObject_Form
 
$type : string
 
$subState : string|null
 

setColor()

public void SetaPDF_Core_Document_Page_Annotation::setColor ( null|bool|int|float|string|array|SetaPDF_Core_DataStructure_Color $color )

Set the color of the annotation.

Parameters
$color : null|bool|int|float|string|array|SetaPDF_Core_DataStructure_Color
 

setContents()

public void SetaPDF_Core_Document_Page_Annotation::setContents ( string|null $contents [, string $encoding = 'UTF-8' ] )

Set the contents of the annotation.

Parameters
$contents : string|null
 
$encoding : string
 

setCreationDate()

public void SetaPDF_Core_Document_Page_Annotation_Markup::setCreationDate ( [ null|bool|string|DateTime|SetaPDF_Core_Type_String|SetaPDF_Core_DataStructure_Date $date = true ] )

Set the creation date.

Parameters
$date : null|bool|string|DateTime|SetaPDF_Core_Type_String|SetaPDF_Core_DataStructure_Date
 
See

setHiddenFlag()

public void SetaPDF_Core_Document_Page_Annotation::setHiddenFlag ( [ boolean $hidden = true ] )

Set the "Hidden" flag.

Parameters
$hidden : boolean
 
See

setIconName()

public void SetaPDF_Core_Document_Page_Annotation_Text::setIconName ( null|string $iconName )

Set the name of the icon that shall be used in displaying the annotation.

Parameters
$iconName : null|string
 

setInReplyTo()

public void SetaPDF_Core_Document_Page_Annotation_Markup::setInReplyTo ( SetaPDF_Core_Document_Page_Annotation_Markup $annotation )

Set the in reply to annotation object.

Parameters
$annotation : SetaPDF_Core_Document_Page_Annotation_Markup
 
Exceptions

Throws InvalidArgumentException

See

setIndirectObject()

public void SetaPDF_Core_Document_Page_Annotation::setIndirectObject ( SetaPDF_Core_Type_IndirectObjectInterface $indirectReference )

Set the indirect object of this annotation.

Parameters
$indirectReference : SetaPDF_Core_Type_IndirectObjectInterface
 

setInvisibleFlag()

public void SetaPDF_Core_Document_Page_Annotation::setInvisibleFlag ( [ boolean $invisible = true ] )

Set the "Invisible" flag.

Parameters
$invisible : boolean
 
See

setLocked()

public void SetaPDF_Core_Document_Page_Annotation::setLocked ( [ boolean $locked = true ] )

Set the "Locked" flag.

Parameters
$locked : boolean
 
See

setLockedContents()

public void SetaPDF_Core_Document_Page_Annotation::setLockedContents ( [ boolean $lockedContents = true ] )

Set the "LockedContents" flag.

Parameters
$lockedContents : boolean
 
See

setModificationDate()

public void SetaPDF_Core_Document_Page_Annotation::setModificationDate ( [ SetaPDF_Core_DataStructure_Date|string|bool $date = true ] )

Set the modification date.

Parameters
$date : SetaPDF_Core_DataStructure_Date|string|bool
 

setName()

public void SetaPDF_Core_Document_Page_Annotation::setName ( string|null $name [, string $encoding = 'UTF-8' ] )

Set the name of the annotation.

The annotation name, a text string uniquely identifying it among all the annotations on its page.

Parameters
$name : string|null
 
$encoding : string
 

setNoRotateFlag()

public void SetaPDF_Core_Document_Page_Annotation::setNoRotateFlag ( [ boolean $noRotate = true ] )

Set the "NoRotate" flag.

Parameters
$noRotate : boolean
 
See

setNoViewFlag()

public void SetaPDF_Core_Document_Page_Annotation::setNoViewFlag ( [ boolean $noView = true ] )

Set the "NoView" flag.

Parameters
$noView : boolean
 
See

setNoZoomFlag()

public void SetaPDF_Core_Document_Page_Annotation::setNoZoomFlag ( [ boolean $noZoom = true ] )

Set the "NoZoom" flag.

Parameters
$noZoom : boolean
 
See

setOpacity()

public void SetaPDF_Core_Document_Page_Annotation_Markup::setOpacity ( float $opacity )

Set the constant opacity value.

Parameters
$opacity : float
 

setOpen()

public void SetaPDF_Core_Document_Page_Annotation_Text::setOpen ( bool $open )

Sets whether the annotation shall initially be displayed open or not.

Parameters
$open : bool
 

setPopup()

public void SetaPDF_Core_Document_Page_Annotation_Markup::setPopup ( SetaPDF_Core_Document_Page_Annotation_Popup $annotation )

Set the pop-up annotation object.

Parameters
$annotation : SetaPDF_Core_Document_Page_Annotation_Popup
 
Exceptions

Throws InvalidArgumentException

setPrintFlag()

public void SetaPDF_Core_Document_Page_Annotation::setPrintFlag ( [ boolean $print = true ] )

Set the "Print" flag.

Parameters
$print : boolean
 
See

setReadOnlyFlag()

public void SetaPDF_Core_Document_Page_Annotation::setReadOnlyFlag ( [ boolean $readOnly = true ] )

Set the "ReadOnly" flag.

Parameters
$readOnly : boolean
 
See

setRect()

public void SetaPDF_Core_Document_Page_Annotation::setRect ( SetaPDF_Core_DataStructure_Rectangle $rect )

Set the rectangle object.

Parameters
$rect : SetaPDF_Core_DataStructure_Rectangle
 

setState()

public void SetaPDF_Core_Document_Page_Annotation_Text::setState ( string $state )

Set the annotation state.

This annotation should be a reply to another one and following annotation flags has to be set:

$annotation->setAnnotationFlags(
    SetaPDF_Core_Document_Page_Annotation_Flags::HIDDEN |
    SetaPDF_Core_Document_Page_Annotation_Flags::NO_ROTATE |
    SetaPDF_Core_Document_Page_Annotation_Flags::NO_ZOOM |
    SetaPDF_Core_Document_Page_Annotation_Flags::PRINTS
);
Otherwise Acrobat/Reader will not display the state in the comments panel.
Parameters
$state : string
 
See
  • PDF 32000-1:2008 - 12.5.6.3 Annotation States

setStateModel()

public void SetaPDF_Core_Document_Page_Annotation_Text::setStateModel ( string $stateModel )

Set the annotation model.

Parameters
$stateModel : string
 
See
  • PDF 32000-1:2008 - 12.5.6.3 Annotation States

setSubject()

public void SetaPDF_Core_Document_Page_Annotation_Markup::setSubject ( string|null $subject [, string $encoding = 'UTF-8' ] )

Get the subject.

Parameters
$subject : string|null
 
$encoding : string
 
See

setTextLabel()

public void SetaPDF_Core_Document_Page_Annotation_Markup::setTextLabel ( string|null $textLabel [, string $encoding = 'UTF-8' ] )

Set the text label.

Parameters
$textLabel : string|null
 
$encoding : string
 
See

setToggleNoView()

public void SetaPDF_Core_Document_Page_Annotation::setToggleNoView ( [ boolean $toggleNoView = true ] )

Set the "ToggleNoView" flag.

Parameters
$toggleNoView : boolean
 
See

unsetAnnotationFlags()

public void SetaPDF_Core_Document_Page_Annotation::unsetAnnotationFlags ( integer $flags )

Removes a field flag.

Parameters
$flags : integer