| FoxitPDFSDKforWeb v11.1.0 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
PageEditorAddon Class Reference
UIExtension » addons » advanced_edit

Provides page edit functionality for document operations within the UIExtension. More...

Inherits UIXAddon.

## Public Member Functions
| activate (type)
| Activate the page editor. More...
| activateTouchup ()
| Activate the touchup. More...
| changeTextColorByRect (options)
| Change the text color by the rectangle. More...
| deactivate ()
| Deactivate the page editor. Must be called after activate. More...
| deactivateTouchup ()
| Deactivate the touchup. Must be called after activate. More...
| getActiveObject ()
| onClick (pageIndex, point, isPDFPoint=true)
| Trigger the click event. More...
async | setEditingObjectToolStyle (style={})
| Set the editing object tool style. More...
async | setTextToolStyle (style={})
| Set text tool style. More...

## Detailed Description

Provides page edit functionality for document operations within the UIExtension.

Since
  9.2.0

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(pageEditor => {
  if (pageEditor) {
  // ...
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

## Member Function Documentation

## ◆ activate()

PageEditorAddon::activate | ( |  | type | ) |
| inline

Activate the page editor.

Parameters

  type | string - The type of the object to be edited. Supported types are: 'All', 'Text', 'Image', 'Path', 'Shading'.

Returns
  Promise<void> -

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(pageEditor => {
  if (pageEditor) {
  pageEditor.activate('Text');
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  9.2.0

## ◆ activateTouchup()

PageEditorAddon::activateTouchup | ( |  | ) |
| inline

Activate the touchup.

Returns
  Promise<void> -

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(pageEditor => {
  if (pageEditor) {
  pageEditor.activateTouchup();
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  11.0.0

## ◆ changeTextColorByRect()

PageEditorAddon::changeTextColorByRect | ( |  | options | ) |
| inline

Change the text color by the rectangle.

Note
  Usually, you need to activate the touchup function before using this API.

Parameters

  options | object - The options.
  options.pageIndex | number - The page index.
  options.rect | PDFRect - Specifies page rectangle in PDF coordination system.
  options.color | string - New text color to be set. Format: 0xRRGGBB.

Returns
  Promise<void> -

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(async pageEditor => {
  if (pageEditor) {
  await pageEditor.activateTouchup();
  const options = {
  pageIndex: 0,
  rect: {
  "left": 71.86691312384474,
  "top": 382.9574861367837,
  "right": 645.9149722735675,
  "bottom": 199.29759704251387
  },
  color: "0x149bff"
  };
  await pageEditor.changeTextColorByRect(options);
  await pageEditor.deactivateTouchup();
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  11.0.0

## ◆ deactivate()

PageEditorAddon::deactivate | ( |  | ) |
| inline

Deactivate the page editor. Must be called after activate.

Returns
  Promise<void> -

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(pageEditor => {
  if (pageEditor) {
  pageEditor.deactivate();
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  9.2.0

## ◆ deactivateTouchup()

PageEditorAddon::deactivateTouchup | ( |  | ) |
| inline

Deactivate the touchup. Must be called after activate.

Returns
  Promise<void> -

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(pageEditor => {
  if (pageEditor) {
  pageEditor.deactivateTouchup();
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  11.0.0

## ◆ getActiveObject()

PageEditorAddon::getActiveObject | ( |  | ) |
| inline

Get the active graphics object.

Note
  Usually, you need to activate the page editor function before using this API. For activation and deactivation, see [activate]PageEditorAddon#activate and [deactivate]PageEditorAddon#deactivate.

Returns
  Promise<PageGraphicsObject|undefined> - The active graphics object, or undefined if no active object.

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(pageEditor => {
  if (pageEditor) {
  pageEditor.activate('Text').then(() => {
  pageEditor.onClick(0, {x: 100, y: 100}, true).then(() => {
  pageEditor.getActiveObject().then(activeObject => {
  if (activeObject) {
  activeObject.setProperties({
  fontColor: '#FF00FF'
  });
  }
  });
  });
  });
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  9.2.0

## ◆ onClick()

PageEditorAddon::onClick | ( |  | pageIndex,
|  |  | point,
|  |  | isPDFPoint = `true`
| ) |  |
| inline

Trigger the click event.

Note
  Usually, you need to activate the page editor function before using this API. For activation and deactivation, see [activate]PageEditorAddon#activate and [deactivate]PageEditorAddon#deactivate.

This function is recommended to be used in visibile pages.

Parameters

  pageIndex | number - The page index.
  point | Object - The point. If this is a device point, the point should be in the PDFViewer Port coordinate system. The PDF coordinates are recommended.
  point.x | number - The x coordinate.
  point.y | number - The y coordinate.
  isPDFPoint | boolean - Whether the point is a PDF point. Default is true.

Returns
  Promise<void> -

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(pageEditor => {
  if (pageEditor) {
  pageEditor.activate('Text').then(() => {
  pageEditor.onClick(0, {x: 100, y: 100}, true);
  });
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  9.2.0

## ◆ setEditingObjectToolStyle()

async PageEditorAddon::setEditingObjectToolStyle | ( |  | style = `{}` | ) |
| inline

Set the editing object tool style.

Note
  The Settings are valid after activate the page editor. Only include the Edit Object Tool and Add Shapes Tool.

Parameters

  style | object - JSON object which indicates text tool style.
  style.editObjectBox | object - The border style of the editing object box.
  style.editObjectBox.color | number - The color of the editing object box. Format: 0xRRGGBB.
  style.editObjectBox.lineType | number - The line style of the editing object box. Please refer to Line_Type .
  style.addShapeBox | object - The border style of the adding shape box.
  style.addShapeBox.color | number - The color of the adding shape box. Format: 0xRRGGBB.
  style.addShapeBox.lineType | number - The line style of the adding shape box. Please refer to Line_Type .

Returns
  Boolean - true if the style is set successfully, otherwise false.

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(async pageEditor => {
  if (pageEditor) {
  let Line_Type = UIExtension.PDFViewCtrl.PDF.constant.AdvEditor.Line_Type
  let style = {
  editObjectBox:{
  color: 0xFFFF00,
  lineType: Line_Type.thinDashedDotLine
  },
  addShapeBox:{
  color: 0xFF00FF,
  lineType: Line_Type.thickDashedDotLine
  }
  }
  await pageEditor.setEditingObjectToolStyle(style);
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  10.0.0

## ◆ setTextToolStyle()

async PageEditorAddon::setTextToolStyle | ( |  | style = `{}` | ) |
| inline

Set text tool style.

Note
  The Settings are valid before activate the text tool. Only include the Edit Text Tool and Add Text Tool.

Parameters

  style | object - JSON object which indicates text tool style.
  style.cursor | object - The style of cursor.
  style.cursor.color | number - The color of the cursor. Format: 0xRRGGBB.
  style.cursor.lineType | number - The line style of the cursor. Please refer to Line_Type .
  style.editTextBox | object - The border style of edit text box.
  style.editTextBox.color | number - The color of the edit text box. Format: 0xRRGGBB.
  style.editTextBox.lineType | number - The line style of the edit text box. Please refer to Line_Type .
  style.addTextBox | object - The border style of the added text box.
  style.addTextBox.color | number - The color of the added text box. Format: 0xRRGGBB.
  style.addTextBox.lineType | number - The line style of the added text box. Please refer to Line_Type .

Returns
  Boolean - true if the style is set successfully, otherwise false.

Example of obtaining and using the PageEditor Addon:
  pdfui.getAddonInstance('PageEditor').then(async pageEditor => {
  if (pageEditor) {
  let Line_Type = UIExtension.PDFViewCtrl.PDF.constant.AdvEditor.Line_Type
  let style = {
  cursor:{
  color: 0xFF0000,
  lineType: Line_Type.thickDashedLine
  },
  editTextBox:{
  color: 0xFFFF00,
  lineType: Line_Type.thinDashedDotLine
  },
  addTextBox:{
  color: 0xFF00FF,
  lineType: Line_Type.thickDashedDotLine
  }
  }
  await pageEditor.setTextToolStyle(style);
  } else {
  console.error("PageEditor Addon instance not found.");
  }
  });

Since
  10.0.0

@2026 Foxit Software Incorporated. All rights reserved.