FoxitPDFSDKforWeb  v9.2.0
Foxit PDF SDK for Web
PageEditorAddon Class Reference

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

Inherits UIXAddon.

Public Member Functions

 activate (type)
 Activate the page editor. More...
 
 deactivate ()
 Deactivate the page editor. Must be called after activate. More...
 
 getActiveObject ()
 
 onClick (pageIndex, point, isPDFPoint=true)
 Trigger the click event. 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
typestring - 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

◆ 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

◆ getActiveObject()

PageEditorAddon::getActiveObject ( )
inline

Get the active graphics object.

Note
Usually, you need to activate the page editor function before using the APIs. 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 the APIs. For activation and deactivation, see [activate]PageEditorAddon#activate and [deactivate]PageEditorAddon#deactivate.

This function is recommended to be used in visibile pages.

Parameters
pageIndexnumber - The page index.
pointObject - The point. If this is a device point, the point should be in the PDFViewer Port coordinate system. The PDF coordinates are recommended.
point.xnumber - The x coordinate.
point.ynumber - The y coordinate.
isPDFPointboolean - 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

Foxit Software Corporation Logo
@2023 Foxit Software Incorporated. All rights reserved.