Annotation properties

The PDF Reference documents all Annotation properties and specifies how they are stored.

Some property values are stored in the PDF document as names and others are stored as strings (see the PDF Reference for details). A property stored as a name can have only 127 characters.

Examples of properties that have a 127-character limit include AP, beginArrow, endArrow, attachIcon, noteIcon, and soundIcon.

The Annotation properties are:

alignment

doCaption

overlayText

seqNum

AP

fillColor

page

soundIcon

arrowBegin

gestures

point

state

arrowEnd

hidden

points

stateModel

attachIcon

inReplyTo

popupOpen

strokeColor

author

intent

popupRect

style

borderEffectIntensity

leaderExtend

print

subject

borderEffectStyle

leaderLength

quads

textFont

callout

lineEnding

rect

textSize

caretSymbol

lock

readOnly

toggleNoView

contents

modDate

refType

type

creationDate

name

repeat

vertices

dash

noteIcon

richContents

width

delay

noView

richDefaults

 

doc

opacity

rotate

 

alignment

5.0

D 

 

C 

Controls the alignment of the text for a FreeText annotation.

Beginning with version 8.0, when the annotation is of type Redact, this property determines the alignment of the overlayText.

Alignment

Value

Left aligned

0

Centered

1

Right aligned

2

Type

Number

Access

R/W

Annotations

FreeText, Redact

attachment

11.0

 

 

 

Represents the annotAttachment object for a FileAttachment type annotation.

Beginning with version 11.0, when the annotation is of type FileAttachment, this property determines the object to be attached. For annotation types other than FileAttachment, an undefined value is returned. The ESErrorGenral exception occurs if the attachment is invalid.

Type

Object

Access

R

Annotations

FileAttachment

Example

var annot = this.addAnnot({

      page: 0,

      type: "FileAttachment",

      point: [400,500],

      author: "A. C. Robat",

      contents: "Call Smith to get help on this paragraph.",

      cAttachmentPath: "/d/a.pdf"

   });

   var attachmentObj = annot.attachment;

AP

5.0

D 

 

C 

The named appearance of the stamp to be used in displaying a stamp annotation. The names of the standard stamp annotations are given below:

   Approved

   AsIs

   Confidential

   Departmental

   Draft

   Experimental

   Expired

   Final

   ForComment

   ForPublicRelease

   NotApproved

   NotForPublicRelease

   Sold

   TopSecret

Type

String

Access

R/W

Annotations

Stamp

Example

Programmatically add a stamp annotation.

   var annot = this.addAnnot({

      page: 0,

      type: "Stamp",

      author: "A. C. Robat",

      name: "myStamp",

      rect: [400, 400, 550, 500],

      contents: "Try it again, this time with order and method!",

      AP: "NotApproved" });

Note:The name of a particular stamp can be found by opening the PDF file in the Stamps folder that contains the stamp in question. For a list of stamp names currently in use in the document, see the Doc object icons property.

arrowBegin

5.0

D 

 

C 

Determines the line cap style that specifies the shape to be used at the beginning of a line annotation. Permissible values are:

   None (default)

   OpenArrow

   ClosedArrow

   ROpenArrow        // Acrobat 6.0

   RClosedArrow      // Acrobat 6.0

   Butt              // Acrobat 6.0

   Diamond

   Circle

   Square

   Slash             // Acrobat 7.0

Type

String

Access

R/W

Annotations

Line, PolyLine

Example

See the setProps method.

arrowEnd

5.0

D 

 

C 

Determines the line cap style that specifies the shape to be used at the end of a line annotation. The following list shows the allowed values:

   None (default)

   OpenArrow

   ClosedArrow

   ROpenArrow          // Acrobat 6.0

   RClosedArrow        // Acrobat 6.0

   Butt                // Acrobat 6.0

   Diamond

   Circle

   Square

   Slash              // Acrobat 7.0

Type

String

Access

R/W

Annotations

Line, PolyLine

Example

See the setProps method.

attachIcon

5.0

D 

 

C 

The name of an icon to be used in displaying the annotation. Recognized values are listed below:

   Paperclip

   PushPin (default)

   Graph

   Tag

Type

String

Access

R/W

Annotations

FileAttachment

author

5.0

D 

 

C 

Gets or sets the author of the annotation.

Type

String

Access

R/W

Annotations

All

Example

See the contents property.

borderEffectIntensity

6.0

D 

 

C 

The intensity of the border effect, if any. This represents how cloudy a cloudy rectangle, polygon, or oval is.

Type

Number

Access

R/W

Annotations

All

borderEffectStyle

6.0

D 

 

C 

If non-empty, the name of a border effect style. Currently, the only supported border effects are the empty string (nothing) or “C” for cloudy.

Type

String

Access

R/W

Annotations

All

callout

7.0

D 

 

C 

An array of four or six numbers specifying a callout line attached to the free text annotation. See the PDF Reference for additional details.

Type

Array

Access

R/W

Annotations

FreeText

cAttachmentPath

11.0

 

 

 

(Optional) Represents the device-independent path of the file to be attached. If this property is not set, the user is prompted to select a data file using the File Open dialog box. This property does not apply to annotation types other than FileAttachment. See the PDF Reference for additional details.

Type

String

Access

W

Annotations

FileAttachment

Example

var annot = this.addAnnot({

      page: 0,

      type: "FileAttachment",

      point: [400,500],

      author: "A. C. Robat",

      contents: "Call Smith to get help on this paragraph.",

      cAttachmentPath: "/d/a.pdf"

   });

caretSymbol

6.0

D 

 

C 

The symbol associated with a Caret annotation, which is a visual symbol that indicates the presence of text

edits. Valid values are “” (nothing), “P” (paragraph symbol) or “S” (space symbol).

Type

String

Access

R/W

Annotations

Caret

contents

5.0

D 

 

C 

Accesses the contents of any annotation that has a pop-up window. For sound and file attachment annotations, specifies the text to be displayed as a description.

Type

String

Access

R/W

Annotations

All

Example

Create a text annotation, with author and contents specified.

   var annot = this.addAnnot({

      page: 0,

      type: "Text",

      point: [400,500],

      author: "A. C. Robat",

      contents: "Call Smith to get help on this paragraph.",

      noteIcon: "Help"

   });

See also the Doc object addAnnot method.

creationDate

6.0

 

 

C 

The date and time when the annotation was created.

Type

Date

Access

R

Annotations

All

dash

5.0

D 

 

C 

A dash array defining a pattern of dashes and gaps to be used in drawing a dashed border. For example, a value of [3, 2] specifies a border drawn with 3-point dashes alternating with 2-point gaps.

To set the dash array, the style property must be set to D.

Type

Array

Access

R/W

Annotations

FreeText, Line, PolyLine, Polygon, Circle, Square, Ink

Example

Assuming annot is an Annotation object, this example changes the border to dashed.

   annot.setProps({ style: "D", dash: [3,2] });

See also the example following the delay property.

delay

5.0

 

 

C 

If true, property changes to the annotation are queued and then executed when delay is set back to false. (Similar to the Field object delay property.)

Type

Boolean

Access

R/W

Annotations

All

Example

Assuming annot is an Annotation object, the code below changes the border to dashed.

   annot.delay=true;

   annot.style = "D";

   annot.dash = [4,3];

   annot.delay = false;

doc

5.0

 

 

C 

The Doc object of the document in which the annotation resides.

Type

Doc object

Access

R

Annotations

All

Example

Construct an annotation, and illustrate the use of the doc property.

   var inch = 72;

   var annot = this.addAnnot({

      page: 0,

      type: "Square",

      rect: [1*inch, 3*inch, 2*inch, 3.5*inch]

   });

   /* displays, for example, "file:///C|/Adobe/Annots/myDoc.pdf" */

   console.println(annot.doc.URL);

doCaption

7.0

D 

 

C 

If true, draws the rich contents in the line appearance itself.

Type

Boolean

Access

R/W

Annotations

Line

Example

See the example following the points property.

fillColor

5.0

D 

 

C 

Sets the background color for circle, square, line, polygon, polyline, and free text annotations. Values are defined by using transparent, gray, RGB or CMYK color. See Color arrays for information on defining color arrays and how values are used with this property.

Type

Color

Access

R/W

Annotations

Circle, Square, Line, Polygon, PolyLine, FreeText

Example

Create a Circle annotation and set the background color.

   var annot = this.addAnnot(

   {

      type: "Circle",

      page: 0,

      rect: [200,200,400,300],

      author: "A. C. Robat",

      name: "myCircle",

      popupOpen: true,

      popupRect: [200,100,400,200],

      contents: "Hi World!",

      strokeColor: color.red,

      fillColor: ["RGB",1,1,.855]

   });

gestures

5.0

D 

 

C 

An array of arrays, each representing a stroked path. Each array is a series of alternating x and y coordinates in default user space, specifying points along the path. When drawn, the points are connected by straight lines or curves in an implementation-dependent way. See the PDF Reference for more details.

Type

Array

Access

R/W

Annotations

Ink

hidden

5.0

D 

 

C 

If true, the annotation is not shown and there is no user interaction, display, or printing of the annotation.

Type

Boolean

Access

R/W

Annotations

All

inReplyTo

6.0

D 

 

C 

If non-empty, specifies the name value of the annotation that this annotation is in reply to.

Type

String

Access

R/W

Annotations

All

intent

7.0

D 

 

C 

This property allows a markup annotation type to behave differently, depending on the intended use of the annotation. For example, the Callout Tool is a free text annotation with intent set to FreeTextCallout.

Though this property is defined for all annotations, currently, only free text, polygon, and line annotations have non-empty values for intent.

Type

String

Access

R/W

Annotations

All

The table below lists the tools available through the UI for creating annotations with special appearances.

UI

Annotation type

Intent

Callout Tool

FreeText 

FreeTextCallout 

Cloud Tool

Polygon 

PolygonCloud 

Arrow Tool

Line 

LineArrow 

Dimensioning Tool

Line 

LineDimension 

leaderExtend

7.0

D 

 

C 

Specifies the length of leader line extensions that extend from both endpoints of the line, perpendicular to the line. These lines extend from the line proper 180 degrees from the leader lines. The value should always be greater than or equal to zero.

The default is zero (no leader line extension).

Type

Number

Access

R/W

Annotations

Line

leaderLength

7.0

D 

 

C 

Specifies the length of leader lines that extend from both endpoints of the line, perpendicular to the line. The value may be negative to specify an alternate orientation of the leader lines.

The default is 0 (no leader line).

Type

Number

Access

R/W

Annotations

Line

lineEnding

7.0

D 

 

C 

This property determines how the end of a callout line is stroked. It is relevant only for a free text annotation when the value of intent is FreeTextCallout. Recognized values are listed below:

   None (default)

   OpenArrow

   ClosedArrow

   ROpenArrow        // Acrobat 6.0

   RClosedArrow      // Acrobat 6.0

   Butt              // Acrobat 6.0

   Diamond

   Circle

   Square

   Slash             // Acrobat 7.0

Type

String

Access

R/W

Annotations

FreeText

lock

5.0

D 

 

C 

If true, the annotation is locked, which is equivalent to readOnly except that the annotation is accessible through the properties dialog box in the UI.

Type

Boolean

Access

R/W

Annotations

All

modDate

5.0

 

 

C 

The last modification date for the annotation.

Type

Date

Access

R/W

Annotations

All

Example

Print the modification date to the console.

   console.println(util.printd("mmmm dd, yyyy", annot.modDate));

name

5.0

D 

 

C 

The name of an annotation. This value can be used by the Doc object getAnnot method to find and access the properties and methods of the annotation.

Type

String

Access

R/W

Annotations

All

Example

Locate the annotation named myNote and appends a comment.

   var gannot = this.getAnnot(0, "myNote");

   gannot.contents += "\r\rDon’t forget to check with Smith";

noteIcon

5.0

D 

 

C 

The name of an icon to be used in displaying the annotation. Recognized values are given below:

   Check

   Circle

   Comment

   Cross

   Help

   Insert

   Key

   NewParagraph

   Note(default)

   Paragraph

   RightArrow

   RightPointer

   Star

   UpArrow

   UpLeftArrow

Type

String

Access

R/W

Annotations

Text

Example

See the contents property.

noView

5.0

D 

 

C 

If true, the annotation is hidden, but if the annotation has an appearance, that appearance should be used for printing only.

Type

Boolean

Access

R/W

Annotations

All

Example

See the toggleNoView property.

opacity

5.0

D 

 

C 

The constant opacity value to be used in painting the annotation. This value applies to all visible elements of the annotation in its closed state (including its background and border), but not to the pop-up window that appears when the annotation is opened. Permissible values are 0.0 - 1.0. A value of 0.5 makes the annotation semitransparent.

Type

Number

Access

R/W

Annotations

All

overlayText

8.0

D 

 

C 

A text string specifying the overlay text that should be drawn over the redacted region after the affected content has been removed.

Type

String

Access

R/W

Annotations

Redact

Example

Set the redaction properties of a particular redaction annotation.

var a = this.getAnnots();                          // get all annotations in doc

var r = a[0]         ;                          // the first one is Redact type

r.setProps({                                   // now set its properties

   overlayText: " A.C. Robat ",

   alignment: 0,

   repeat: true,

   fillColor:color.blue,

   textColor: color.green

});

There is a popup associated with a Redact annotation, now add content to this popup note.

r.setProps({                contents: "Shall we redact this paragraph?" });

See also the applyRedactions method of the Doc object.

page

5.0

D 

 

C 

The page on which the annotation resides.

Type

Integer

Access

R/W

Annotations

All

Example

The following code moves the Annotation object annot from its current page to page 3 (0-based page numbering system).

   annot.page = 2;

point

5.0

D 

 

C 

An array of two numbers, [xul, yul] that specifies the upper left-hand corner in default user space of the icon for a text, sound or file attachment annotation.

Type

Array

Access

R/W

Annotations

Text, Sound, FileAttachment

Example

Place a help note icon at specified coordinates. The icon is located at the upper right corner of the popup note.

   var annot = this.addAnnot({

      page: 0,

      type: "Text",

      point: [400,500],

      contents: "Call Smith to get help on this paragraph.",

      popupRect: [400,400,550,500],

      popupOpen: true,

      noteIcon: "Help"

   });

See also the noteIcon property and the Doc object addAnnot method.

points

5.0

D 

 

C 

An array of two points, [[x1, y1], [x2, y2]], specifying the starting and ending coordinates of the line in default user space.

Type

Array

Access

R/W

Annotations

Line

Example

Draw a line between two specified points.

   var annot = this.addAnnot({

      type: "Line",

      page: 0,

      author: "A. C. Robat",

      doCaption: true,

      contents: "Look at this again!",

      points: [[10,40],[200,200]],

   });

See the arrowBegin and arrowEnd properties, the setProps method, and the Doc object addAnnot method.

popupOpen

5.0

D 

 

C 

If true, the pop-up text note appears open when the page is displayed.

Type

Boolean

Access

R/W

Annotations

All except FreeText, Sound, FileAttachment

Example

See the print property.

popupRect

5.0

D 

 

C 

An array of four numbers [xll, yll, xur, yur] specifying the lower-left x, lower-left y, upper-right x, and upper-right y coordinates—in default user space—of the rectangle of the pop-up annotation associated with a parent annotation. It defines the location of the pop-up annotation on the page.

Type

Array

Access

R/W

Annotations

All except FreeText, Sound, FileAttachment

Example

See the print property.

print

5.0

D 

 

C 

Indicates whether the annotation should be printed (true) or not (false).

Type

Boolean

Access

R/W

Annotations

All

quads

5.0

D 

 

C 

An array of 8 x n numbers specifying the coordinates of n quadrilaterals in default user space. Each quadrilateral encompasses a word or group of contiguous words in the text underlying the annotation. See the PDF Reference for more details. The quads for a word can be obtained through calls to the Doc object getPageNthWordQuads method.

Type

Array

Access

R/W

Annotations

Highlight, StrikeOut, Underline, Squiggly,Redact

Example

See the Doc object getPageNthWordQuads method.

rect

5.0

D 

 

C 

The rect array consists of four numbers [xll, yll, xur, yur] specifying the lower-left x, lower-left y, upper-right x, and upper-right y coordinates—in default user space—of the rectangle defining the location of the annotation on the page. See also the popupRect property.

Type

Array

Access

R/W

Annotations

All

readOnly

5.0

D 

 

C 

If true, the annotation should display but not interact with the user.

Type

Boolean

Access

R/W

Annotations

All

refType

7.0

D 

 

C 

The reference type of the annotation. The property distinguishes whether inReplyTo indicates a plain threaded discussion relationship or a group relationship. Recognized values are “R” and “Group”. See the PDF Reference for additional details.

Type

String

Access

R/W

Annotations

All

repeat

8.0

D 

 

C 

If true, the text specified by overlayText should be repeated to fill the redacted region after the affected content has been removed. Default value: false.

Type

Boolean

Access

R/W

Annotations

Redact

richContents

6.0

D 

 

C 

This property gets the text contents and formatting of an annotation. The rich text contents are represented as an array of Span objects containing the text contents and formatting of the annotation.

Type

Array of Span objects

Access

R/W

Annotations

All except Sound, FileAttachment

Example

Create a text annotation and give it some rich text contents.

   var annot = this.addAnnot({

      page: 0,

      type: "Text",

      point: [72,500],

      popupRect: [72, 500,6*72,500-2*72],

      popupOpen: true,

      noteIcon: "Help"

   });

   

   var spans = new Array();

   spans[0] = new Object();

   spans[0].text = "Attention:\r";

   spans[0].textColor = color.blue;

   spans[0].textSize = 18;

   

   spans[1] = new Object();

   spans[1].text = "Adobe Acrobat 6.0\r";

   spans[1].textColor = color.red;

   spans[1].textSize = 20;

   spans[1].alignment = "center";

   

   spans[2] = new Object();

   spans[2].text = "will soon be here!";

   spans[2].textColor = color.green;

   spans[2].fontStyle = "italic";

   spans[2].underline = true;

   spans[2].alignment = "right";

   

   // Now give the rich field a rich value

   annot.richContents = spans;

See also the Field object richValue method and the event object methods richValue, richChange, and richChangeEx for examples of using the Span object.

richDefaults

6.0

D 

 

C 

This property defines the default style attributes for a free text annotation. See the description of the Field object defaultStyle property for additional details.

Type

Span object

Access

R/W

Annotations

FreeText

rotate

5.0

D 

 

C 

The number of degrees (0, 90, 180, 270) the annotation is rotated counterclockwise relative to the page. This property is only significant for free text annotations.

Type

Integer

Access

R/W

Annotations

FreeText

seqNum

5.0

 

 

C 

A read-only sequence number for the annotation on the page.

Type

Integer

Access

R

Annotations

All

soundIcon

5.0

D 

 

C 

The name of an icon to be used in displaying the sound annotation. A value of “Speaker” is recognized.

Type

String

Access

R/W

Annotations

Sound

state

6.0

D 

 

C 

The state of the text annotation. The values of this property depend on the stateModel. For a state model of Marked, values are Marked and Unmarked. For a Review state model, the values are Accepted, Rejected, Cancelled, Completed and None.

Type

String

Access

R/W

Annotations

Text

stateModel

6.0

D 

 

C 

Beginning with Acrobat 6.0, annotations may have an author-specific state associated with them. The state is specified by a separate text annotation that refers to the original annotation by means of its IRT entry (see the inReplyTo property). There are two types of state models, “Marked” and “Review”.

Type

String

Access

R/W

Annotations

Text

See also the getStateInModel method.

strokeColor

5.0

D 

 

C 

Sets the appearance color of the annotation. Values are defined by using transparent, gray, RGB or CMYK color. In the case of a free text annotation, strokeColor sets the border and text colors. See Color arrays for information on defining color arrays and how values are used with this property.

Type

Color

Access

R/W

Annotations

All

Example

Make a text note red.

   var annot = this.addAnnot({type: "Text"});

   annot.strokeColor = color.red;

style

5.0

D 

 

C 

This property gets and sets the border style. Recognized values are S (solid) and D (dashed). The style property is defined for all annotation types but is only relevant for line, free text, circle, square, polyline, polygon and ink annotations.

Type

String

Access

R/W

Annotations

All

See the dash property for an example.

subject

6.0

D 

 

C 

Text representing a short description of the subject being addressed by the annotation. The text appears in the title bar of the pop-up window, if there is one, or the properties dialog box.

Type

String

Access

R/W

Annotations

All

textFont

5.0

D 

 

C 

Determines the font that is used when laying out text in a free text annotation. Valid fonts are defined as properties of the font object (see the Field object textFont property).

An arbitrary font can be used when laying out a free text annotation by setting the value of textFont equal to a string that represents the PostScript name of the font.

Type

String

Access

R/W

Annotations

FreeText

Example

Create a FreeText annotation using the Helvetica font.

   var annot = this.addAnnot({

      page: 0,

      type: "FreeText",

      textFont: font.Helv, // or, textFont: "Viva-Regular",

      textSize: 10,

      rect: [200, 300, 200+150, 300+3*12], // height for three lines

      width: 1,

      alignment: 1 });

textSize

5.0

D 

 

C 

The text size (in points) for a free text annotation. Valid text sizes include zero and the range from 4 to 144, inclusive. Zero indicates the largest point size that allows all the text to fit in the annotation’s rectangle.

Type

Number

Access

R/W

Annotations

FreeText

Example

See the textFont property.

toggleNoView

6.0

D 

 

C 

If true, the noView flag is toggled when the mouse hovers over the annotation or the annotation is selected.

If an annotation has both the noView and toggleNoView flags set, the annotation is usually invisible. However, when the mouse is over it or it is selected, it becomes visible.

Type

Boolean

Access

R/W

Annotations

All

type

5.0

 

 

C 

The type of annotation. The type of an annotation can only be set within the object-literal argument of the Doc object addAnnot method. The valid values are:

   Text

   FreeText

   Line

   Square

   Circle

   Polygon

   PolyLine

   Highlight

   Underline

   Squiggly

   StrikeOut

   Stamp

   Caret

   Ink

   FileAttachment

   Sound

Type

String

Access

R

Annotations

All

vertices

6.0

D 

 

C 

An array of coordinate arrays representing the alternating horizontal and vertical coordinates, respectively, of each vertex, in default user space of a polygon or polyline annotation. See the PDF Reference for details.

Type

Array of arrays

Access

R/W

Annotations

Polygon, PolyLine

width

5.0

D 

 

C 

The border width in points. If this value is 0, no border is drawn. The default value is 1.

Type

Number

Access

R/W

Annotations

Square, Circle, Line, Ink, FreeText