| FoxitPDFSDKforWeb v11.0.5 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
Annot Class Reference
PDF » annots

PDF annot object. More...

Inheritance diagram for Annot:

## Public Member Functions
| appendAction (actionSpec)
| Appends a action to the annotation. This function cannot be used to append action which is used as additional action. More...
| exportToJSON ()
| Export the current annotation to a Json object. [Support in Server] More...
| getActionData ()
| Retrieves the action associated with this annotation. This function cannot be used to get action which is used as additional action. More...
| getAllActionData ()
| Gets all action data associated with the annotation. This method retrieves all action data including both primary and additional actions of the annotation. The action will be grouped by action trigger type: ActionTriggerEvents.ANNOT_MOUSE_BUTTON_RELEASED. More...
| getAnnotId ()
| Retrieves the unique identifier of the annotation. The identifier consists of two components: the page index and the object number, which together ensure the annotation's uniqueness within the document. More...
| getBorderColor ()
| Get annotation's border color. [Support in Server] More...
| getBorderInfo ()
| Get annotation's border information. [Support in Server] More...
| getBorderStyle ()
| Get annotation's border style. More...
| getContent ()
| Get annotation's contents. [Support in Server] More...
| getDictionaryEntry (key)
| Get the dictionary property of Annot by key. More...
| getFlags ()
| Get annotation's flag. [Support in Server] More...
| getModifiedDateTime ()
| Get annotation's last modified date time. [Support in Server] More...
| getObjectNumber ()
| Get annotation's object number. More...
| getPage ()
| Get annotation's page. [Support in Server] More...
| getRect ()
| Get annotation's rect. [Support in Server] More...
| getTitle ()
| Get annotation's title. [Support in Server] More...
| getType ()
| Get annotation's type. [Support in Server] More...
| getUniqueID ()
| Get annotation's unique ID. [Support in Server] More...
| isEmpty ()
| Check annotation is empty or not. [Support in Server] More...
| isMarkup ()
| Check if current annotation is a markup annotation. [Support in Server] More...
| removeAction (actionObjNumber)
| Removes a action from the annotation. This function cannot be used to remove action which is used as additional action. More...
| setAction (actionSpec)
| Set the action for the annotation. This function cannot be used to set action which is used as additional action. More...
| setBorderColor (borderColor)
| Set annotation's border color. [Support in Server] More...
| setBorderInfo (borderInfo)
| Set annotation's border information. [Support in Server] More...
| setBorderStyle (borderStyle, styleParam)
| Set annotation's border style. More...
| setContent (content)
| Set contents for the currently gotten annotation. [Support in Server] More...
| setCustomAPStream (appearanceType, appearanceStream)
| setDictionaryEntry (key, value)
| Add a new entry or replace the existing entry of the annotation dictionary. Caller could use this method to store their private data to the annotation. Do not use any standard key of the annotation dictionary, such as 'Type', 'Subtype', 'Rect' defined in PDF Reference. If any standard key is used, this behaviour will be undefined. More...
| setFlags (flag, notTriggerEvent)
| Set annotation's flag. [Support in Server] More...
| setModifiedDateTime (date)
| Set annotation's last modified date time. [Support in Server] More...
| setRect (rect)
| Set annotation's rect. More...
| supportsAction ()
| This method checks the annotation type and returns true if the type is screen, link or sound annotation, Indicating that are supports actions. For other types of annotation, it returns false. More...
| updateAction (actionObjNumber, actionData)
| Updates an existing action in the annotation. This function cannot be used to update action which is used as additional action. More...
Public Member Functions inherited from Disposable
| addDestroyHook (...hooks)
| Add a function to destroyHooks list, which will be called during destroy. More...
| destroy ()
| ownsTo (owner)
| Establishes an ownership relationship where this instance will be destroyed when the owner is destroyed. Additionally, the owner will be automatically removed from the destroyHooks list when this instance is destroyed. More...

## Detailed Description

PDF annot object.

## Member Function Documentation

## ◆ appendAction()

Annot::appendAction | ( |  | actionSpec | ) |
| inline

Appends a action to the annotation. This function cannot be used to append action which is used as additional action.

Note
  Only supports screen, link, sound, widget annotation. This method adds a new action specified by `actionSpec` to the annotation's action list.

Parameters

  actionSpec | ActionSpecification - The specification of the action to be appended.

Returns
  Promise<void> - Resolves when the action is successfully appended.

Note
  Currently we don't support to create an embedded goto action (type: ActionType.gotoE).

Since
  11.0.0

## ◆ exportToJSON()

Annot::exportToJSON | ( |  | ) |
| inline

Export the current annotation to a Json object. [Support in Server]

Returns
  object - A json object of annotation's property. The key and value formats try to follow XFDF specifications

Note
  Binary data will not be exported with this function. Use PDFDoc::exportAnnotsToJSON instead.
  {
  type: string,
  color: string,
  flags: string,
  date:string,//{D:20190321150656+08'00'}
  name: string,
  page: number,
  rect: string,
  contents: string,
  width: borderWidth,
  customEntries:object // Custom data
  }

## ◆ getActionData()

Annot::getActionData | ( |  | ) |
| inline

Retrieves the action associated with this annotation. This function cannot be used to get action which is used as additional action.

Note
  Only supports screen, link, sound, widget annotation. Use this method to get the main action that defines the primary behavior of the annotation, such as opening a link, running a script, etc.

Returns
  Promise<ActionHierarchy|undefined> - Resolves with the action hierarchy data.

Since
  11.0.0

## ◆ getAllActionData()

Annot::getAllActionData | ( |  | ) |
| inline

Gets all action data associated with the annotation. This method retrieves all action data including both primary and additional actions of the annotation. The action will be grouped by action trigger type: ActionTriggerEvents.ANNOT_MOUSE_BUTTON_RELEASED.

Returns
  Promise<{trigger:AnnotActionTriggerEvents;data:ActionHierarchy;}[]> -

Since
  11.0.0

## ◆ getAnnotId()

Annot::getAnnotId | ( |  | ) |
| inline

Retrieves the unique identifier of the annotation. The identifier consists of two components: the page index and the object number, which together ensure the annotation's uniqueness within the document.

Returns
  AnnotId - The unique identifier of the annotation.

Since
  11.0.0

## ◆ getBorderColor()

Annot::getBorderColor | ( |  | ) |
| inline

Get annotation's border color. [Support in Server]

Returns
  number - An integer indicating border color will be returned. Format: 0xRRGGBB.

## ◆ getBorderInfo()

Annot::getBorderInfo | ( |  | ) |
| inline

Get annotation's border information. [Support in Server]

Returns
  {cloudIntensity:number, dashPhase: number, dashes: number[], style: number, width: number} -
  {
  cloudIntensity:{number},//Intensity of the cloudy effect, only 0~2 is valid.
  dashPhase:{number},//Dash phase.
  dashes:Array[number],//A dash array that represents the dash patterns. It's valid when border style is dashed.
  style:{number},//Please refer to {@link Border_Style} for details.
  width:{number}
  }

## ◆ getBorderStyle()

Annot::getBorderStyle | ( |  | ) |
| inline

Get annotation's border style.

Returns
  number - An integer indicating border style. Refer to #BORDER_STYLE.

Since
  11.0.0

## ◆ getContent()

Annot::getContent | ( |  | ) |
| inline

Get annotation's contents. [Support in Server]

Returns
  string - Annotation's contents will be returned.

## ◆ getDictionaryEntry()

Annot::getDictionaryEntry | ( |  | key | ) |
| inline

Get the dictionary property of Annot by key.

Parameters

  key | string - The key of the entry, whose value element will be get. It should not be an empty string. function example(annot){ annot.getDictionaryEntry("*") }

Since
  7.5.0

Returns
  Promise<string> - A string indicates annotation's key

## ◆ getFlags()

Annot::getFlags | ( |  | ) |
| inline

Get annotation's flag. [Support in Server]

Returns
  number - Annotation flag number.

See also
  Annot_Flags

## ◆ getModifiedDateTime()

Annot::getModifiedDateTime | ( |  | ) |
| inline

Get annotation's last modified date time. [Support in Server]

Returns
  Date|null - A Date object, If there is no modified date time information, null would be returned

## ◆ getObjectNumber()

Annot::getObjectNumber | ( |  | ) |
| inline

Get annotation's object number.

Returns
  number - A number indicates annotation's object number.

Since
  8.1.0

## ◆ getPage()

Annot::getPage | ( |  | ) |
| inline

Get annotation's page. [Support in Server]

Returns
  PDFPage - PDF page object.

## ◆ getRect()

Annot::getRect | ( |  | ) |
| inline

Get annotation's rect. [Support in Server]

Returns
  PDFRect - A PDF rectangle.
  {
  left:{number},
  top:{number},
  right:{number},
  bottom:{number}
  }

## ◆ getTitle()

Annot::getTitle | ( |  | ) |
| inline

Get annotation's title. [Support in Server]

Returns
  string - A string indicates annotation's title.

## ◆ getType()

Annot::getType | ( |  | ) |
| inline

Get annotation's type. [Support in Server]

Returns
  string - A string indicates annotation's type.

See also
  Annot_Type

## ◆ getUniqueID()

Annot::getUniqueID | ( |  | ) |
| inline

Get annotation's unique ID. [Support in Server]

Returns
  string - A string indicates annotation's unique ID.

## ◆ isEmpty()

Annot::isEmpty | ( |  | ) |
| inline

Check annotation is empty or not. [Support in Server]

Returns
  boolean - Annotation is empty or not

## ◆ isMarkup()

Annot::isMarkup | ( |  | ) |
| inline

Check if current annotation is a markup annotation. [Support in Server]

Returns
  boolean - true means current annotation is a markup annotation, while false means current annotation is not a markup annotation.

## ◆ removeAction()

Annot::removeAction | ( |  | actionObjNumber | ) |
| inline

Removes a action from the annotation. This function cannot be used to remove action which is used as additional action.

Note
  Only supports screen, link, sound, widget annotation. This method removes the action with the specified `actionObjNumber` from the annotation's action list.

Parameters

  actionObjNumber | number - The object number of the action to be removed, if not specified, all actions will be removed.

Returns
  Promise<boolean> - Resolves when the action is successfully removed.

Since
  11.0.0

## ◆ setAction()

Annot::setAction | ( |  | actionSpec | ) |
| inline

Set the action for the annotation. This function cannot be used to set action which is used as additional action.

Note
  Only supports screen, link, sound, widget annotation. This method sets the action specified by `actionSpec` for the annotation.

Parameters

  actionSpec | ActionSpecification - The specification of the action to be set.

Returns
  Promise<void> - Resolves when the action is successfully set.

Since
  11.0.0

## ◆ setBorderColor()

Annot::setBorderColor | ( |  | borderColor | ) |
| inline

Set annotation's border color. [Support in Server]

Parameters

  borderColor | number|[string,number,number,number]|string - Specify border color (alpha is not supported). Supported color format: number, such as 0xff0000, 16711680 PDF color array, such as ['RGB',1,1,1] which means white. Range: 0.0~1.0, The ratio to HTML color format is 1:255. HTML color format, such as '#ff0000', 'rgb(255,0,0)', 'rgba(255,0,0,1)'

Returns
  Promise<boolean> - A boolean value indicating whether success.

## ◆ setBorderInfo()

Annot::setBorderInfo | ( |  | borderInfo | ) |
| inline

Set annotation's border information. [Support in Server]

Note
  The cloudy segments are only honored by polygon, square and circle. If the cloud style was applied to others like text markup, caret, stamp, ink and note, no effect will be drawn.

Parameters

  borderInfo | object - Border infomation.
  [borderInfo.cloudIntensity] | number - Cloud intensity, Valid value range: 0 to 2. 0 means no cloudy border effect. If the value is below 0, it will have the same effect as value 0. If the value is above 2, it will have the same effect as value 2.
  [borderInfo.dashPhase] | number - Dash phase.
  [borderInfo.dashes] | number[] - Dashes array.
  borderInfo.style | Border_Style - Border style, only Border_Style.solid, Border_Style.dashed Border_Style.cloudy and Border_Style.noBorder are supported.
  borderInfo.width | number - Border width. interface BorderInfo { cloudIntensity: number,//Intensity of the cloudy effect, only 0,1 and 2 is valid. dashPhase:number,//Dash phase. dashes:number[],//A dash array that represents the dash patterns. style:number, width:number, // unsigned integer. }

Returns
  Promise<void>

## ◆ setBorderStyle()

Annot::setBorderStyle | ( |  | borderStyle,
|  |  | styleParam
| ) |  |
| inline

Set annotation's border style.

Parameters

  borderStyle | number - Border style. Only Border_Style.solid, Border_Style.dash Border_Style.cloudy and Border_Style.noBorder are supported.
  [styleParam] | number|number[] - A number indicating cloud intensity or an array indicating dash pattern.

Returns
  Promise<void>

Since
  11.0.0

## ◆ setContent()

Annot::setContent | ( |  | content | ) |
| inline

Set contents for the currently gotten annotation. [Support in Server]

Parameters

  content | string - New contents to be setted.

Returns
  Promise<Annot[]|Annot> - Annotations modified will be returned.

## ◆ setCustomAPStream()

Annot::setCustomAPStream | ( |  | appearanceType,
|  |  | appearanceStream
| ) |  |
| inline

Set the customized appearance stream for the annotation.

Parameters

  appearanceType | string - The type of annotation's appearance. It should be one of the following values: 'normal' - Annotation's normal appearance. 'rollover' - Annotation's rollover appearance. 'down' - Annotation's down appearance.
  appearanceStream | string - The customized appearance stream.

Since
  10.0.0

## ◆ setDictionaryEntry()

Annot::setDictionaryEntry | ( |  | key,
|  |  | value
| ) |  |
| inline

Add a new entry or replace the existing entry of the annotation dictionary. Caller could use this method to store their private data to the annotation. Do not use any standard key of the annotation dictionary, such as 'Type', 'Subtype', 'Rect' defined in PDF Reference. If any standard key is used, this behaviour will be undefined.

Parameters

  key | string - The key of the entry, whose value element will be set. It should not be an empty string.
  value | string - A wide string which will be set as PDF string object to the entry. function example(annot){ annot.setDictionaryEntry("**","**") }

Since
  7.5.0

Returns
  Promise<boolean> - A boolean value indicates success or failure

## ◆ setFlags()

Annot::setFlags | ( |  | flag,
|  |  | notTriggerEvent
| ) |  |
| inline

Set annotation's flag. [Support in Server]

Parameters

  flag | number - An Annot_Flags number indicating annotation's flag.

Returns
  Promise<boolean> - A boolean value indicating the success or failue.

See also
  Annot_Flags

## ◆ setModifiedDateTime()

Annot::setModifiedDateTime | ( |  | date | ) |
| inline

Set annotation's last modified date time. [Support in Server]

Parameters

  date | Date|number - A Date object or an integer indicating million secounds from 1970.1.1 00:00:00.

Returns
  Promise<boolean>

## ◆ setRect()

Annot::setRect | ( |  | rect | ) |
| inline

Set annotation's rect.

Note
  The paging seal signature is not supported. Please use PDFDoc.updatePagingSealInfo

Parameters

  rect | PDFRect - Rectangle to be setted.

Returns
  Promise<boolean> - true for success, otherwise failure.

Since
  8.5.0

## ◆ supportsAction()

Annot::supportsAction | ( |  | ) |
| inline

This method checks the annotation type and returns true if the type is screen, link or sound annotation, Indicating that are supports actions. For other types of annotation, it returns false.

Returns
  boolean - Whether the annotation supports actions.

Since
  11.0.0

## ◆ updateAction()

Annot::updateAction | ( |  | actionObjNumber,
|  |  | actionData
| ) |  |
| inline

Updates an existing action in the annotation. This function cannot be used to update action which is used as additional action.

Note
  Only supports screen, link, sound, widget annotation. This method only update the action data of the action specified by `actionObjNumber`, and does not change the action type.

Parameters

  actionObjNumber | number - The object number of the action to be updated.
  actionData | ActionData - The data of the action to be updated.

Returns
  Promise<void> - Resolves when the action is successfully updated.

Since
  11.0.0

@2025 Foxit Software Incorporated. All rights reserved.