Annotation

16 Dec 20254 minutes to read

The Annotation module is used to handle annotation actions of PDF viewer.

Methods

addAnnotation

Method used to add annotations using program.

Parameter Type Description
annotationType AnnotationType It describes type of annotation object.
options (optional) FreeTextSettings | StickyNotesSettings | HighlightSettings | UnderlineSettings | SquigglySettings | LineSettings | StrikethroughSettings | RectangleSettings | CircleSettings | ArrowSettings | PolygonSettings | DistanceSettings | PerimeterSettings | AreaSettings | RedactionSettings | RadiusSettings | VolumeSettings | InkAnnotationSettings | HandWrittenSignatureSettings | StampSettings | CustomStampSettings It describes about the annotation objects and it’s property.
dynamicStampItem (optional) DynamicStampItem It describe which type of dynamic stamp.
signStampItem (optional) SignStampItem It describe which type of sign stamp.
standardBusinessStampItem (optional) StandardBusinessStampItem It describe which type of standard business stamp.

Returns void

addPageRedactions

Adds redaction annotations that cover the entire content of the specified pages in the PDF document.
This redaction customization feature shall be available only when the PDF Viewer is operating in Standalone Mode.

Parameter Type Description
pages number[] pages

Returns void

clearSelection

Clear the annotation selection.

Returns void

editAnnotation

Updates the existing properties of the specified annotation object.

Parameter Type Description
annotation any The annotation object that contains the properties to be updated.
The object should include valid annotation properties such as type, bounds, color, opacity, etc.
Modifying these properties will update the annotation in the PDF Viewer accordingly.

Returns void

hexToRgba

Converts a hex color string to an RGBA color string.
This function takes a hex color string as input and attempts to parse it into
an RGBA color string format. The conversion works by extracting the red, green,
blue, and alpha (transparency) values from the hex string, then formatting
these into a standard CSS rgba() string.

If the input string is not a valid hex color, the function will catch the error
and return the original input string. This serves as a fallback for non-hex colors.

Parameter Type Description
hex string The color in hexadecimal format (#RRGGBB or #RRGGBBAA).

Returns string

redact

Applies redaction to all Redaction annotations in the PDF document.
This redaction customization feature shall be available only when the PDF Viewer is operating in Standalone Mode.

Returns void

selectAnnotation

Select the annotations using annotation object or annotation Id.

Parameter Type Description
annotationId string | object annptationId

Returns void

setAnnotationMode

Set annotation type to be added in next user interaction in PDF Document.

Parameter Type Description
type AnnotationType type
dynamicStampItem (optional) DynamicStampItem dynamicStampItem
signStampItem (optional) SignStampItem signStampItem
standardBusinessStampItem (optional) StandardBusinessStampItem standardBusinessStampItem.

Returns void