Class Annotations.Annotation
Represents an annotation.
Constructor Attributes | Constructor Name and Description |
---|---|
The base class for all annotations
|
Field Attributes | Field Name and Description |
---|---|
The author of the annotation.
|
|
Gets or sets a custom property on the annotation.
|
|
Gets or sets the date that the annotation was last modified.
|
|
Gets or sets the name of the annotation element in XFDF.
|
|
Gets or sets the height of the annotation
|
|
Gets or sets whether the annotation is hidden.
|
|
A unique identifier for the annotation.
|
|
Gets or sets whether the annotation has been added since the last time the AnnotCommand was retrieved.
|
|
Gets or sets whether the annotation has been deleted since the last time the AnnotCommand was retrieved.
|
|
Gets or sets whether the annotation has been modified since the last time the AnnotCommand was retrieved.
|
|
Gets or sets whether or not the annotation can be moved
|
|
Gets or sets if this annotation can be resized by the user.
|
|
Gets or sets if this annotation can be rotated.
|
|
Gets or sets if this annotation scales with the page.
|
|
Gets or sets the page number of a document that the annotation appears on.
|
|
Represents the subject of the annotation.
|
|
Gets or sets the width of the annotation
|
|
Gets or sets the annotation's x-axis position.
|
|
Gets or sets the annotation's y-axis position.
|
Method Attributes | Method Name and Description |
---|---|
Adjusts the annotation's bounding rectangle to take into account changes to the annotation
e.g.
|
|
deserialize(element, pageMatrix)
Deserializes the xml element into the annotation
|
|
draw(ctx)
Draws the annotation on the provide canvas context, relative to the page.
|
|
[deprecated] |
Gets the bottommost y position measured in page coordinates.
|
Gets the text content for the annotation.
|
|
Gets the custom value set by SetCustom
|
|
getFlag(flag)
Determine if the give flag is marked flagged
|
|
Gets the height of the annotation.
|
|
[deprecated] |
GetLeft()
Gets the leftmost x position measured in page coordinates.
|
Gets the page number of the annotation.
|
|
[deprecated] |
Gets the popup text for the annotation.
|
getRect()
Get annotation bounding rectangle
|
|
Gets the padding that will be applied by default on the annotation's rectangle.
|
|
Gets the list of replies to this annotation.
|
|
[deprecated] |
GetRight()
Gets the rightmost x position measured in page coordinates.
|
[deprecated] |
GetTop()
Gets the topmost y position measured in page coordinates.
|
GetWidth()
Gets the width of the annotation.
|
|
GetX()
Gets the x position measured in page coordinates of an annotation.
|
|
GetY()
Gets the y position measured in page coordinates.
|
|
isReply()
Gets whether the annotation is a reply to another annotation.
|
|
resize(rect)
Resize the annotation based on a new given Annotations.Rect.
|
|
serialize(element, pageMatrix)
Serialize the annotation to an xml element
|
|
setContents(the)
Set the text content for the annotation.
|
|
SetCustom(value)
Sets a custom value on the annotation.
|
|
setFlag(flag, value)
Set the value of given Flag.
|
|
SetHeight(value)
Sets the height of the annotation.
|
|
SetPageNumber(value)
Sets the page number of the annotation.
|
|
[deprecated] |
SetPopupComment(the)
Set the popup text for the annotation.
|
setRect(rect)
Sets the size and location of the annotation's bounding rectangle.
|
|
SetWidth(value)
Sets the width of the annotation.
|
|
SetX(value)
Sets the x position measured in page coordinates of an annotation.
|
|
SetY()
Sets the y position measured in page coordinates.
|
Field Detail
{string}
Author
The author of the annotation.
{*}
Custom
Gets or sets a custom property on the annotation.
{Date}
DateModified
Gets or sets the date that the annotation was last modified.
{string}
elementName
Gets or sets the name of the annotation element in XFDF.
{number}
Height
Gets or sets the height of the annotation
{boolean}
Hidden
Gets or sets whether the annotation is hidden.
{string}
Id
A unique identifier for the annotation. Corresponds to the name attribute in XFDF.
{boolean}
IsAdded
Gets or sets whether the annotation has been added since the last time the AnnotCommand was retrieved.
{boolean}
IsDeleted
Gets or sets whether the annotation has been deleted since the last time the AnnotCommand was retrieved.
{boolean}
IsModified
Gets or sets whether the annotation has been modified since the last time the AnnotCommand was retrieved.
{boolean}
NoMove
Gets or sets whether or not the annotation can be moved
{boolean}
NoResize
Gets or sets if this annotation can be resized by the user.
{boolean}
NoRotate
Gets or sets if this annotation can be rotated.
{boolean}
NoZoom
Gets or sets if this annotation scales with the page.
{number}
PageNumber
Gets or sets the page number of a document that the annotation appears on.
{string}
Subject
Represents the subject of the annotation. Default is the annotation's type.
{number}
Width
Gets or sets the width of the annotation
{number}
X
Gets or sets the annotation's x-axis position.
{number}
Y
Gets or sets the annotation's y-axis position.
Method Detail
adjustRect()
Adjusts the annotation's bounding rectangle to take into account changes to the annotation
e.g. stroke thickness, start/end points, etc
deserialize(element, pageMatrix)
Deserializes the xml element into the annotation
- Parameters:
- {Element} element
- an xml element representing the annotation
- {object} pageMatrix
- the page matrix used to convert PDF coordinates to XOD coordinates.
draw(ctx)
Draws the annotation on the provide canvas context, relative to the page.
The point (0,0) coresponds to the top left corner of the page.
- Parameters:
- {CanvasRenderingContext2D} ctx
- The canvas context prepared to be drawn on.
{number}
GetBottom()
Gets the bottommost y position measured in page coordinates.
- Deprecated:
- since 1.7
- Returns:
- {number}
{string}
getContents()
Gets the text content for the annotation.
Contents may be displayed in an annotation's popup or directly on the page (in the case of FreeTextAnnotation).
- Returns:
- {string} the text content for the annotation.
{*}
GetCustom()
Gets the custom value set by SetCustom
- Returns:
- {*} The custom value
{boolean}
getFlag(flag)
Determine if the give flag is marked flagged
- Parameters:
- {number} flag
- Returns:
- {boolean}
{number}
GetHeight()
Gets the height of the annotation.
- Returns:
- {number} the height of the annotation.
{number}
GetLeft()
Gets the leftmost x position measured in page coordinates.
- Deprecated:
- since 1.7
- Returns:
- {number}
{number}
GetPageNumber()
Gets the page number of the annotation.
Note: page number starts from 1.
- Returns:
- {number} The annotation's page number
{string}
GetPopupComment()
Gets the popup text for the annotation.
This is the text that is displayed when you open the annotation's popup.
- Deprecated:
- since 1.7. Use {Annotations.Annotation#getContents} instead.
- Returns:
- {string} the popup text for the annotation.
{Annotations.Rect}
getRect()
Get annotation bounding rectangle
- Returns:
- {Annotations.Rect}
{number}
getRectPadding()
Gets the padding that will be applied by default on the annotation's rectangle.
- Returns:
- {number} The amount of padding
{Array}
getReplies()
Gets the list of replies to this annotation.
- Returns:
- {Array} The list of replies
{number}
GetRight()
Gets the rightmost x position measured in page coordinates.
- Deprecated:
- since 1.7
- Returns:
- {number}
{number}
GetTop()
Gets the topmost y position measured in page coordinates.
- Deprecated:
- since 1.7
- Returns:
- {number}
{number}
GetWidth()
Gets the width of the annotation.
- Returns:
- {number} the width of the annotation.
{number}
GetX()
Gets the x position measured in page coordinates of an annotation.
- Returns:
- {number} the x position
{number}
GetY()
Gets the y position measured in page coordinates.
- Returns:
- {number}
{boolean}
isReply()
Gets whether the annotation is a reply to another annotation.
- Returns:
- {boolean} Returns true if it does reply to another annotation, false otherwise.
resize(rect)
Resize the annotation based on a new given Annotations.Rect.
Use this method instead of setRect when internal properties (other than x, y, width and height) need to be modified on move/resize.
- Parameters:
- {Annotations.Rect} rect
- the new bounding rectangle
{Element}
serialize(element, pageMatrix)
Serialize the annotation to an xml element
- Parameters:
- {Element} element
- an xml element representing the annotation
- {object} pageMatrix
- the page matrix used to convert XOD coordinates to PDF coordinates.
- Returns:
- {Element} the resulting xml element representing the annotation
setContents(the)
Set the text content for the annotation.
Note that this will not refresh the text in the UI.
- Parameters:
- {string} the
- text content to be set
SetCustom(value)
Sets a custom value on the annotation.
- Parameters:
- {*} value
- Any custom value
setFlag(flag, value)
Set the value of given Flag.
- Parameters:
- {number} flag
- {boolean} value
SetHeight(value)
Sets the height of the annotation.
- Parameters:
- {number} value
- the height of the annotation.
SetPageNumber(value)
Sets the page number of the annotation.
Note: page numbers start from 1.
- Parameters:
- {number} value
- the page number to be set
SetPopupComment(the)
Set the popup text for the annotation.
Note that this will not refresh the text in the UI.
- Parameters:
- {string} the
- popup comment to be set
- Deprecated:
- since 1.7. Use {Annotations.Annotation#setContents} instead.
setRect(rect)
Sets the size and location of the annotation's bounding rectangle.
Use this method instead of resize when only the x, y, width and height needs to be modified.
- Parameters:
- {Annotations.Rect} rect
- the new bounding rectangle
SetWidth(value)
Sets the width of the annotation.
- Parameters:
- {number} value
- the width of the annotation.
SetX(value)
Sets the x position measured in page coordinates of an annotation.
- Parameters:
- {number} value
- the x position
SetY()
Sets the y position measured in page coordinates.
- Parameters:
- {number}