PDFiumAnnotation
Defined in: src/document/annotation.ts:85
Represents a single annotation on a PDF page.
Extends
Section titled “Extends”Implements
Section titled “Implements”Accessors
Section titled “Accessors”attachmentPointCount
Section titled “attachmentPointCount”Get Signature
Section titled “Get Signature”get attachmentPointCount():
number
Defined in: src/document/annotation.ts:610
Gets the number of attachment point sets (quad points) for this markup annotation.
Returns
Section titled “Returns”number
author
Section titled “author”Get Signature
Section titled “Get Signature”get author():
string|undefined
Defined in: src/document/annotation.ts:364
The author (‘T’ key) of this annotation.
Returns
Section titled “Returns”string | undefined
Set Signature
Section titled “Set Signature”set author(
value):void
Defined in: src/document/annotation.ts:368
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | string |
Returns
Section titled “Returns”void
bounds
Section titled “bounds”Get Signature
Section titled “Get Signature”get bounds():
Rect
Defined in: src/document/annotation.ts:134
Gets the bounding rectangle of this annotation.
Returns a zero-rect if the annotation has no rectangle set. Use getRect to distinguish between “no rect” (null) and a valid rect.
This getter satisfies the Annotation interface.
Returns
Section titled “Returns”The bounding rectangle in page coordinates.
Implementation of
Section titled “Implementation of”colour
Section titled “colour”Get Signature
Section titled “Get Signature”get colour():
Colour|null
Defined in: src/document/annotation.ts:145
Gets the stroke colour of this annotation, if set.
This value is cached at construction time and invalidated by setColour.
This getter satisfies the Annotation interface.
Returns
Section titled “Returns”Colour | null
The annotation colour, or null if not set.
Implementation of
Section titled “Implementation of”contents
Section titled “contents”Get Signature
Section titled “Get Signature”get contents():
string|undefined
Defined in: src/document/annotation.ts:355
The ‘Contents’ dictionary value (e.g. text body of a note).
Returns
Section titled “Returns”string | undefined
Set Signature
Section titled “Set Signature”set contents(
value):void
Defined in: src/document/annotation.ts:359
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | string |
Returns
Section titled “Returns”void
disposed
Section titled “disposed”Get Signature
Section titled “Get Signature”get disposed():
boolean
Defined in: src/core/disposable.ts:73
Whether this resource has been disposed.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get flags():
AnnotationFlags
Defined in: src/document/annotation.ts:181
Gets the annotation flags.
Returns
Section titled “Returns”Get Signature
Section titled “Get Signature”get index():
number
Defined in: src/document/annotation.ts:154
Gets the zero-based index of this annotation on its page.
This value is cached at construction time.
Returns
Section titled “Returns”number
Zero-based index of the annotation on its page.
Implementation of
Section titled “Implementation of”inkPathCount
Section titled “inkPathCount”Get Signature
Section titled “Get Signature”get inkPathCount():
number
Defined in: src/document/annotation.ts:541
Gets the number of ink paths in this ink annotation.
Returns
Section titled “Returns”number
objectCount
Section titled “objectCount”Get Signature
Section titled “Get Signature”get objectCount():
number
Defined in: src/document/annotation.ts:173
Gets the number of page objects in this annotation.
Only ink and stamp annotations typically have objects.
Returns
Section titled “Returns”number
subject
Section titled “subject”Get Signature
Section titled “Get Signature”get subject():
string|undefined
Defined in: src/document/annotation.ts:373
The subject of this annotation.
Returns
Section titled “Returns”string | undefined
Set Signature
Section titled “Set Signature”set subject(
value):void
Defined in: src/document/annotation.ts:377
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value | string |
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get type():
AnnotationType
Defined in: src/document/annotation.ts:120
Gets the annotation subtype (e.g. Text, Highlight, Ink, Link).
Returns
Section titled “Returns”The annotation subtype.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: src/core/disposable.ts:148
Dispose of this resource, freeing WASM memory.
This method is idempotent - calling it multiple times has no effect after the first call.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”addInkStroke()
Section titled “addInkStroke()”addInkStroke(
points):number
Defined in: src/document/annotation.ts:583
Adds an ink stroke to this ink annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
points | readonly Point[] | Array of points defining the ink stroke |
Returns
Section titled “Returns”number
The index of the added stroke, or -1 on failure
appendAttachmentPoints()
Section titled “appendAttachmentPoints()”appendAttachmentPoints(
quadPoints):boolean
Defined in: src/document/annotation.ts:675
Appends attachment points (quad points) to this markup annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
quadPoints | QuadPoints | The quad points to append |
Returns
Section titled “Returns”boolean
True if successful
appendObject()
Section titled “appendObject()”appendObject(
object):boolean
Defined in: src/document/annotation.ts:705
Appends a page object to this annotation.
Only ink and stamp annotations support object manipulation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
object | PDFiumPageObject | The page object to append |
Returns
Section titled “Returns”boolean
True if successful
dispose()
Section titled “dispose()”dispose():
void
Defined in: src/core/disposable.ts:164
Alias for Symbol.dispose for explicit calls.
Returns
Section titled “Returns”void
Example
Section titled “Example”document.dispose();Inherited from
Section titled “Inherited from”focus()
Section titled “focus()”focus():
boolean
Defined in: src/document/annotation.ts:939
Sets this annotation as the focused annotation in the form.
Returns
Section titled “Returns”boolean
True if successful
getAppearance()
Section titled “getAppearance()”getAppearance(
mode):string|undefined
Defined in: src/document/annotation.ts:437
Gets the appearance stream of this annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
mode | AnnotationAppearanceMode | The appearance mode to retrieve |
Returns
Section titled “Returns”string | undefined
The appearance stream string, or undefined if not available
getAttachmentPoints()
Section titled “getAttachmentPoints()”getAttachmentPoints(
quadIndex):QuadPoints|null
Defined in: src/document/annotation.ts:621
Gets attachment points (quad points) for this markup annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
quadIndex | number | Zero-based quad points index |
Returns
Section titled “Returns”QuadPoints | null
Quad points, or null if not available
getBorder()
Section titled “getBorder()”getBorder():
AnnotationBorder|null
Defined in: src/document/annotation.ts:390
Gets the border properties of this annotation.
Returns
Section titled “Returns”AnnotationBorder | null
Border properties, or null if not available
getColour()
Section titled “getColour()”getColour(
colourType):Colour|null
Defined in: src/document/annotation.ts:231
Gets the colour of this annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
colourType | AnnotationColourType | 'stroke' | Which colour channel: 'stroke' (default) or 'interior' |
Returns
Section titled “Returns”Colour | null
The colour, or null if not available
getFontSize()
Section titled “getFontSize()”getFontSize():
number|null
Defined in: src/document/annotation.ts:775
Gets the font size for a free text annotation.
Returns
Section titled “Returns”number | null
The font size, or null if not available
getFormControlCount()
Section titled “getFormControlCount()”getFormControlCount():
number
Defined in: src/document/annotation.ts:794
Gets the number of form controls for this form field annotation.
Returns
Section titled “Returns”number
getFormControlIndex()
Section titled “getFormControlIndex()”getFormControlIndex():
number
Defined in: src/document/annotation.ts:805
Gets the form control index for this form field annotation.
Returns
Section titled “Returns”number
The form control index, or -1 if not found
getFormFieldAlternateName()
Section titled “getFormFieldAlternateName()”getFormFieldAlternateName():
string|undefined
Defined in: src/document/annotation.ts:895
Gets the alternate (tooltip) name for this form field widget annotation.
Returns
Section titled “Returns”string | undefined
The alternate name, or undefined if not available
getFormFieldExportValue()
Section titled “getFormFieldExportValue()”getFormFieldExportValue():
string|undefined
Defined in: src/document/annotation.ts:820
Gets the export value of this form field annotation.
Returns
Section titled “Returns”string | undefined
The export value, or undefined if not available
getFormFieldFlags()
Section titled “getFormFieldFlags()”getFormFieldFlags():
FormFieldFlags
Defined in: src/document/annotation.ts:856
Gets the form field flags for this widget annotation.
Returns
Section titled “Returns”The form field flags bitmask, or FormFieldFlags.None if not a widget
getFormFieldName()
Section titled “getFormFieldName()”getFormFieldName():
string|undefined
Defined in: src/document/annotation.ts:869
Gets the form field name for this widget annotation.
Returns
Section titled “Returns”string | undefined
The field name, or undefined if not available
getFormFieldOptions()
Section titled “getFormFieldOptions()”getFormFieldOptions():
WidgetOption[] |undefined
Defined in: src/document/annotation.ts:908
Gets the options for a combo box or list box widget annotation.
Returns
Section titled “Returns”WidgetOption[] | undefined
Array of options, or undefined if not a combo/list box or no options
getFormFieldType()
Section titled “getFormFieldType()”getFormFieldType():
FormFieldType
Defined in: src/document/annotation.ts:844
Gets the form field type for this widget annotation.
Returns
Section titled “Returns”The form field type, or FormFieldType.Unknown if not a widget
getFormFieldValue()
Section titled “getFormFieldValue()”getFormFieldValue():
string|undefined
Defined in: src/document/annotation.ts:882
Gets the current value of this form field widget annotation.
Returns
Section titled “Returns”string | undefined
The field value, or undefined if not available
getInkPath()
Section titled “getInkPath()”getInkPath(
pathIndex):Point[] |null
Defined in: src/document/annotation.ts:552
Gets the points in an ink path.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
pathIndex | number | Zero-based path index |
Returns
Section titled “Returns”Point[] | null
Array of points, or null if not available
getLine()
Section titled “getLine()”getLine():
LinePoints|null
Defined in: src/document/annotation.ts:474
Gets the line endpoints for a line annotation.
Returns
Section titled “Returns”LinePoints | null
Line endpoints, or null if not a line annotation
getLink()
Section titled “getLink()”getLink():
PDFLink|null
Defined in: src/document/annotation.ts:745
Gets the link associated with this link annotation.
Returns
Section titled “Returns”PDFLink | null
The link, or null if not found
getRect()
Section titled “getRect()”getRect():
Rect|null
Defined in: src/document/annotation.ts:195
Gets the bounding rectangle of this annotation.
Returns
Section titled “Returns”Rect | null
The bounding rectangle, or null if not available
getStringValue()
Section titled “getStringValue()”getStringValue(
key):string|undefined
Defined in: src/document/annotation.ts:328
Gets a string value from this annotation’s dictionary.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
key | DictionaryKey | The dictionary key |
Returns
Section titled “Returns”string | undefined
The string value, or undefined if not available
getVertices()
Section titled “getVertices()”getVertices():
Point[] |null
Defined in: src/document/annotation.ts:509
Gets the vertices of a polygon or polyline annotation.
Returns
Section titled “Returns”Point[] | null
Array of points, or null if not a polygon/polyline annotation
hasKey()
Section titled “hasKey()”hasKey(
key):boolean
Defined in: src/document/annotation.ts:314
Checks if this annotation has a specific key in its dictionary.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
key | DictionaryKey | The key name to check |
Returns
Section titled “Returns”boolean
True if the key exists
isWidget()
Section titled “isWidget()”isWidget():
boolean
Defined in: src/document/annotation.ts:835
Returns true if this annotation is a valid form widget (Widget subtype with a known field type).
Returns
Section titled “Returns”boolean
removeObject()
Section titled “removeObject()”removeObject(
objectIndex):boolean
Defined in: src/document/annotation.ts:731
Removes a page object from this annotation.
Only ink and stamp annotations support object manipulation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
objectIndex | number | The zero-based index of the object to remove |
Returns
Section titled “Returns”boolean
True if successful
setAppearance()
Section titled “setAppearance()”setAppearance(
mode,value):boolean
Defined in: src/document/annotation.ts:452
Sets the appearance stream of this annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
mode | AnnotationAppearanceMode | The appearance mode to set |
value | string | undefined | The appearance stream value, or undefined to remove |
Returns
Section titled “Returns”boolean
True if successful
setAttachmentPoints()
Section titled “setAttachmentPoints()”setAttachmentPoints(
quadIndex,quadPoints):boolean
Defined in: src/document/annotation.ts:651
Sets attachment points (quad points) for this markup annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
quadIndex | number | Zero-based quad points index |
quadPoints | QuadPoints | The quad points to set |
Returns
Section titled “Returns”boolean
True if successful
setBorder()
Section titled “setBorder()”setBorder(
border):boolean
Defined in: src/document/annotation.ts:415
Sets the border of this annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
border | AnnotationBorder | The border properties |
Returns
Section titled “Returns”boolean
True if successful
setColour()
Section titled “setColour()”setColour(
colour,colourType):boolean
Defined in: src/document/annotation.ts:270
Sets the colour of this annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
colour | Colour | undefined | The colour to set |
colourType | AnnotationColourType | 'stroke' | Which colour channel: 'stroke' (default) or 'interior' |
Returns
Section titled “Returns”boolean
True if successful
setFlags()
Section titled “setFlags()”setFlags(
flags):boolean
Defined in: src/document/annotation.ts:299
Sets the flags of this annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
flags | AnnotationFlags | The annotation flags to set |
Returns
Section titled “Returns”boolean
True if successful
setRect()
Section titled “setRect()”setRect(
bounds):boolean
Defined in: src/document/annotation.ts:211
Sets the bounding rectangle of this annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
bounds | Rect | The new bounding rectangle |
Returns
Section titled “Returns”boolean
True if successful
setStringValue()
Section titled “setStringValue()”setStringValue(
key,value):boolean
Defined in: src/document/annotation.ts:343
Sets a string value in this annotation’s dictionary.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
key | DictionaryKey | The dictionary key |
value | string | The string value to set |
Returns
Section titled “Returns”boolean
True if successful
setURI()
Section titled “setURI()”setURI(
uri):boolean
Defined in: src/document/annotation.ts:758
Sets the URI for this link annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
uri | string | The URI to set |
Returns
Section titled “Returns”boolean
True if successful
updateObject()
Section titled “updateObject()”updateObject(
object):boolean
Defined in: src/document/annotation.ts:718
Updates a page object in this annotation.
The object must already be in the annotation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
object | PDFiumPageObject | The page object to update |
Returns
Section titled “Returns”boolean
True if successful