| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

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

Free text annot object. More...

Inheritance diagram for FreeText:

## Public Member Functions
| exportToJSON ()
| Export annotation to a json object. [Support in Server] Override Markup::exportToJSON. More...
| getAlignment ()
| Get the alignment information of Free Text contents. Note that this property is not supported for typewriter annotations. More...
| getCalloutLineEndingStyle ()
| Get callout line ending style. [Support in Server] More...
| getCalloutLinePoints ()
| Get points of callout line. [Support in Server] More...
| getDefaultAppearance ()
| Get annotation's default appearance [Support in Server] More...
| getFillColor ()
| Get free text's fill color. [Support in Server] More...
| getInnerRect ()
| Get annotation's innert rect, in PDF coordination system. [Support in Server] More...
| getRotation ()
| Get current rotation angle (in clockwise). More...
| setAlignment (value)
| Controls the alignment of Free Text contents. Note that this property is not supported for typewriter annotations. More...
| setCalloutLineEndingStyle (endingStyle)
| Get callout line ending style. [Support in Server] More...
| setCalloutLinePoints (calloutLinePoints)
| Set annotation's callout points. [Support in Server] More...
| setDefaultAppearance (defaultAppearance)
| Set the default annotation appearances. Before using this function to set the font, you should call setJRFontMap() to map the available fonts.[Support in Server] More...
| setFillColor (fillColor)
| Set free text's fill color. [Support in Server] More...
| setInnerRect (rect)
| Set annotation's inner rect. [Support in Server] More...
| setRotation (rotation)
| Set rotation value (in clockwise). More...
Public Member Functions inherited from Markup
| addMarkedState (stateName)
| Add marked state with specific name [Support in Server] More...
| addReply (content)
| Add a new reply to the end of reply list. [Support in Server] More...
| addReviewState (stateName)
| Add review state with specific name. [Support in Server] More...
| addRichText (datas)
| Add new text data with rich styles to the end. Note: Now, only support Freetext annotation. if current annotation is a freetext and its intent is "FreeTextTypewriter", text aligment of input style will be set to all rich text strings of current freetext annotation. More...
| exportToJSON ()
| Export annotation to a json object. [Support in Server] Override Annot::exportToJSON. More...
| getBorderOpacity ()
| Get markup annotation's border opacity. More...
| getCreateDateTime ()
| Get creation date time. [Support in Server] More...
| getFillOpacity ()
| Get markup annotation's fill opacity. More...
| getGroupElements ()
| Get the group annotations which own current annotation. [Support in Server] More...
| getGroupHeader ()
| Get the header annotation (as primary annotation) of the group that current markup annotation belongs to. [Support in Server] More...
| getIntent ()
| Get intent name. Following annotation types have predefined intent name: More...
| getMarkedState (index)
| Get a state annotation by index. state model is marked [Support in Server] More...
| getMarkedStateCount ()
| Get the count of state annotations. [Support in Server] More...
| getMarkedStates ()
| Get all state annotation. state model is marked [Support in Server] More...
| getOpacity ()
| Get opacity value. This property has effect on markup annotation's appearance. [Support in Server] More...
| getPopup ()
| Get annotation's popup. [Support in Server] More...
| getReplies ()
| Get all replies [Support in Server] More...
| getReply (index)
| Get a reply annot by index. [Support in Server] More...
| getReplyCount ()
| Count all replies. [Support in Server] More...
| getReviewState (index)
| Get a state annotation by index. state model is review [Support in Server] More...
| getReviewStateCount ()
| Get the count of state annotations. [Support in Server] When state model is review, the markup annotation can have several state annotations in a chain: first state annotation refers to the markup annotation, second state annotation refers to the first state annotation, etc. Just like this: markup annotation <– reviewed state1 <– reviewed state2 ... More...
| getReviewStates ()
| Get all state annotation. state model is review [Support in Server] More...
| getRichText ()
| Get the rich text data, including rich text strings and styles. Note: Now, only support Freetext annotation. if current annotation is a freetext and its intent is "FreeTextTypewriter", text aligment of input style will be set to all rich text strings of current freetext annotation. More...
| getSubject ()
| Get subject string. [Support in Server] More...
| getTitle ()
| Get title string. [Support in Server] More...
| insertRichText (datas)
| Insert rich text string to the place which is specified by indexs. More...
| isGrouped ()
| Check whether current markup annotation is in a group or not. [Support in Server] More...
| isGroupHeader ()
| Check whether current markup annotation is a group header annotation. [Support in Server] More...
| removeAllStateAnnots ()
| Remove all sate from this markup annotation. [Support in Server] More...
| removeRichText (indexes)
| Remove a rich text string specified by index. More...
| setBorderOpacity (opacity)
| Set markup annotation's border opacity. More...
| setContent (content)
| Set markup annotation's contents. [Support in Server] More...
| setCreateDateTime (date)
| Set creation date time. [Support in Server] More...
| setFillOpacity (opacity)
| Set markup annotation's fill opacity. More...
| setIntent (intent)
| Set annotaions's intent. More...
| setOpacity (opacity)
| Set opacity value. [Support in Server] More...
| setRichText (datas)
| Set the rich text data with rich styles to the place which is specified by indexes. Note: Now, only support Freetext annotation. if current annotation is a freetext and its intent is "FreeTextTypewriter", text alignment of input style will be set to all rich text strings of current freetext annotation. More...
| setSubject (subject)
| Set subject string. [Support in Server] More...
| setTitle (title)
| Set title string. [Support in Server] More...
Public Member Functions inherited from Annot
| 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

Free text annot object.

## Member Function Documentation

## ◆ exportToJSON()

FreeText::exportToJSON | ( |  | ) |
| inline

Export annotation to a json object. [Support in Server] Override Markup::exportToJSON.

Returns
  object - A json object with free text properties:
  {
  ...MarkupAnnotJSON,//JSON object from Markup::exportToJSON()
  fringe:{string}, //"[{left},{bottom},{right},{top}]",
  callout:"{x1},{y1},{x2},{y2},{x3},{y3}" // Callout line points. Only when the intent name of a free text annotation is "FreeTextCallout", this free text annotation can have callout line points property, and this property has effect on this kind of free text annotation's appearance. For a callout line, it can contain 2 or 3 points: 2 points represent the starting point and ending point of the callout line; 3 points represent the starting point, knee point, and ending point of the callout line.
  head:{string},//one of
  \li 'None'
  \li 'Square'
  \li 'Circle'
  \li 'Diamond'
  \li 'OpenArrow'
  \li 'ClosedArrow'
  \li 'Butt'
  \li 'ReverseOpenArrow'
  \li 'ReverseClosedArrow'
  \li 'Slash'
  }

## ◆ getAlignment()

FreeText::getAlignment | ( |  | ) |
| inline

Get the alignment information of Free Text contents. Note that this property is not supported for typewriter annotations.

Returns
  number - An integer indicates alignment. Please Refer to Alignment.

## ◆ getCalloutLineEndingStyle()

FreeText::getCalloutLineEndingStyle | ( |  | ) |
| inline

Get callout line ending style. [Support in Server]

Returns
  number - An integer value, one of:

See also
  Ending_Style

## ◆ getCalloutLinePoints()

FreeText::getCalloutLinePoints | ( |  | ) |
| inline

Get points of callout line. [Support in Server]

Returns
  Array<{x:number,y:number}> - An array of line points.
  [
  {
  x:{number},
  y:{number}
  },
  {
  x:{number},
  y:{number}
  },
  {
  x:{number},
  y:{number}
  }
  ]

## ◆ getDefaultAppearance()

FreeText::getDefaultAppearance | ( |  | ) |
| inline

Get annotation's default appearance [Support in Server]

Since
  7.2.0

Returns
  object - A json object of default appearance.
  {
  textColor: 0xff0000ff,//default appearance's text color,
  textSize: 12//default appearance's text size
  }

## ◆ getFillColor()

FreeText::getFillColor | ( |  | ) |
| inline

Get free text's fill color. [Support in Server]

Returns
  number - An integer indicating fill color.

## ◆ getInnerRect()

FreeText::getInnerRect | ( |  | ) |
| inline

Get annotation's innert rect, in PDF coordination system. [Support in Server]

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

## ◆ getRotation()

FreeText::getRotation | ( |  | ) |
| inline

Get current rotation angle (in clockwise).

Returns
  number - Current rotation angle (in clockwise). this should be one of these values : 0, 90, 180, 270.

Since
  8.2.0

## ◆ setAlignment()

FreeText::setAlignment | ( |  | value | ) |
| inline

Controls the alignment of Free Text contents. Note that this property is not supported for typewriter annotations.

Parameters

  value | number - Alignment. Please Refer to Alignment.

See also
  Alignment

Since
  7.2.0

## ◆ setCalloutLineEndingStyle()

FreeText::setCalloutLineEndingStyle | ( |  | endingStyle | ) |
| inline

Get callout line ending style. [Support in Server]

Parameters

  endingStyle | number - An integer value indicating ending style.Please refer to Ending_Style.

Returns
  Promise<void>

## ◆ setCalloutLinePoints()

FreeText::setCalloutLinePoints | ( |  | calloutLinePoints | ) |
| inline

Set annotation's callout points. [Support in Server]

Parameters

  calloutLinePoints | Array<{x:number,y:number}> - An array of line points. [ { x:{number}, y:{number} }, { x:{number}, y:{number} }, { x:{number}, y:{number} } ]

Returns
  Promise<void>

## ◆ setDefaultAppearance()

FreeText::setDefaultAppearance | ( |  | defaultAppearance | ) |
| inline

Set the default annotation appearances. Before using this function to set the font, you should call setJRFontMap() to map the available fonts.[Support in Server]

Since
  7.2.0

Parameters

  defaultAppearance | object - Json object of default appearance.
  defaultAppearance.textColor | number - Default appearance text color (0xRRGGBB).
  defaultAppearance.textSize | number - Default appearance text size. Range: 6~40;
  defaultAppearance.font | object - Json object of font.
  defaultAppearance.font.name | string - The font face name.
  defaultAppearance.font.styles | number - The font styles. Please refer to Font_Styles .
  defaultAppearance.font.charset | number - The charset of the font. Please refer to Font_Charset or Font_CIDCharset .

Returns
  Promise<void> -
  function example(annot){
  annot.setDefaultAppearance({
  textColor: 0xffff00ff,
  textSize: 6,
  font: {
  "name": "Rage",
  "styles": PDFViewCtrl.PDF.constant.Font_Styles[AllCap],
  "charset": PDFViewCtrl.PDF.constant.Font_Charset[ANSI]
  }
  })
  }

## ◆ setFillColor()

FreeText::setFillColor | ( |  | fillColor | ) |
| inline

Set free text's fill color. [Support in Server]

Parameters

  fillColor | number|['T']|[string,number,number,number]|string - An integer indicating fill color (alpha is not supported). Supported color format: 0 or ['T'] for transparent 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 the success or failue.

## ◆ setInnerRect()

FreeText::setInnerRect | ( |  | rect | ) |
| inline

Set annotation's inner rect. [Support in Server]

Parameters

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

## ◆ setRotation()

FreeText::setRotation | ( |  | rotation | ) |
| inline

Set rotation value (in clockwise).

Parameters

  rotation | number - New rotation value (in clockwise) to be set to current free text annotation, this should be one of these values : 0, 90, 180, 270.

Since
  8.2.0

Returns
  Promise<void>

@2025 Foxit Software Incorporated. All rights reserved.