The
Some property values are stored in the PDF document as names and others are stored as strings (see the
Examples of properties that have a 127-character limit include AP, beginArrow, endArrow, attachIcon, noteIcon, and soundIcon.
The Annotation properties are:
|
|||
|
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 |
Number
R/W
FreeText, Redact
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.
Object
R
FileAttachment
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;
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
String
R/W
Stamp
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.
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
String
R/W
Line, PolyLine
See the setProps method.
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
String
R/W
Line, PolyLine
See the setProps method.
The name of an icon to be used in displaying the annotation. Recognized values are listed below:
Paperclip
PushPin (default)
Graph
Tag
String
R/W
FileAttachment
5.0 |
|
Gets or sets the author of the annotation.
String
R/W
All
See the contents property.
The intensity of the border effect, if any. This represents how cloudy a cloudy rectangle, polygon, or oval is.
Number
R/W
All
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.
String
R/W
All
An array of four or six numbers specifying a callout line attached to the free text annotation. See the
Array
R/W
FreeText
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
String
W
FileAttachment
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"
});
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).
String
R/W
Caret
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.
String
R/W
All
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.
The date and time when the annotation was created.
Date
R
All
5.0 |
|
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.
Array
R/W
FreeText, Line, PolyLine, Polygon, Circle, Square, Ink
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.
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.)
Boolean
R/W
All
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;
The Doc object of the document in which the annotation resides.
Doc object
R
All
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);
If true, draws the rich contents in the line appearance itself.
Boolean
R/W
Line
See the example following the points property.
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.
Color
R/W
Circle, Square, Line, Polygon, PolyLine, FreeText
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]
});
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
Array
R/W
Ink
If true, the annotation is not shown and there is no user interaction, display, or printing of the annotation.
Boolean
R/W
All
6.0 |
|
If non-empty, specifies the name value of the annotation that this annotation is in reply to.
String
R/W
All
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.
String
R/W
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 |
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).
Number
R/W
Line
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).
Number
R/W
Line
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
String
R/W
FreeText
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.
Boolean
R/W
All
The last modification date for the annotation.
Date
R/W
All
Print the modification date to the console.
console.println(util.printd("mmmm dd, yyyy", annot.modDate));
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.
String
R/W
All
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";
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
String
R/W
Text
See the contents property.
If true, the annotation is hidden, but if the annotation has an appearance, that appearance should be used for printing only.
Boolean
R/W
All
See the toggleNoView property.
5.0 |
|
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.
Number
R/W
All
8.0 |
|
A text string specifying the overlay text that should be drawn over the redacted region after the affected content has been removed.
String
R/W
Redact
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.
5.0 |
|
The page on which the annotation resides.
Integer
R/W
All
The following code moves the Annotation object annot from its current page to page 3 (0-based page numbering system).
annot.page = 2;
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.
Array
R/W
Text, Sound, FileAttachment
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.
An array of two points, [[x1, y1], [x2, y2]], specifying the starting and ending coordinates of the line in default user space.
Array
R/W
Line
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.
If true, the pop-up text note appears open when the page is displayed.
Boolean
R/W
All except FreeText, Sound, FileAttachment
See the print property.
5.0 |
|
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.
Array
R/W
All except FreeText, Sound, FileAttachment
See the print property.
Indicates whether the annotation should be printed (true) or not (false).
Boolean
R/W
All
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
Array
R/W
Highlight, StrikeOut, Underline, Squiggly,Redact
See the Doc object getPageNthWordQuads method.
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.
Array
R/W
All
If true, the annotation should display but not interact with the user.
Boolean
R/W
All
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
String
R/W
All
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.
Boolean
R/W
Redact
6.0 |
|
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.
Array of Span objects
R/W
All except Sound, FileAttachment
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.
This property defines the default style attributes for a free text annotation. See the description of the Field object defaultStyle property for additional details.
Span object
R/W
FreeText
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.
Integer
R/W
FreeText
A read-only sequence number for the annotation on the page.
Integer
R
All
The name of an icon to be used in displaying the sound annotation. A value of “Speaker” is recognized.
String
R/W
Sound
6.0 |
|
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.
String
R/W
Text
Beginning with
String
R/W
Text
See also the getStateInModel method.
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.
Color
R/W
All
Make a text note red.
var annot = this.addAnnot({type: "Text"});
annot.strokeColor = color.red;
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.
String
R/W
All
See the dash property for an example.
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.
String
R/W
All
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.
String
R/W
FreeText
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 });
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.
Number
R/W
FreeText
See the textFont property.
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.
Boolean
R/W
All
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
String
R
All
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
Array of arrays
R/W
Polygon, PolyLine
The border width in points. If this value is 0, no border is drawn. The default value is 1.
Number
R/W
Square, Circle, Line, Ink, FreeText