FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
UndoRedoAddon Class Reference

This addon provides comprehensive undo and redo operations at a global level within the document environment. It supports undoing and redoing actions related to bookmarks, annotations, and advanced editing (AdvEdit) functionalities. Users can efficiently revert or reapply changes made to bookmarks, annotations, and advanced editing tasks within the document, enhancing the overall control and flexibility of document management. More...

Inherits UIXAddon.

Public Member Functions

 invoke (callback)
 Executes a callback function to add document operation history to the undo stack. More...
 
 redo ()
 Redoes the previously undone document operation. More...
 
 undo ()
 Undoes the last document operation. More...
 
 undoAll ()
 Undoes the all document operations. More...
 

Detailed Description

This addon provides comprehensive undo and redo operations at a global level within the document environment. It supports undoing and redoing actions related to bookmarks, annotations, and advanced editing (AdvEdit) functionalities. Users can efficiently revert or reapply changes made to bookmarks, annotations, and advanced editing tasks within the document, enhancing the overall control and flexibility of document management.

Since
9.2.0
Example of obtaining and using the UndoRedo Addon:
pdfui.getAddonInstance('UndoRedoAddon').then(undoRedoAddon => {
if (undoRedoAddon) {
undoRedoAddon.undo();
} else {
console.error("UndoRedo Addon instance not found.");
}
});

Member Function Documentation

◆ invoke()

UndoRedoAddon::invoke (   callback)
inline

Executes a callback function to add document operation history to the undo stack.

Use this method to execute a callback function that performs document operations, such as creating, deleting, or modifying annotations. The operation history of these actions will be automatically added to the undo stack, enabling users to undo these actions if needed. If no document is currently open, the pdfDoc parameter within the callback function will be null.

Parameters
callback(pdfDoc:PDFDoc)=>void - A callback function that receives a pdfDoc parameter and should perform the document operation to be added to the undo stack.
Returns
void -
Since
9.2.0
Example of using this API:
pdfui.getAddonInstance('UndoRedoAddon').then(undoRedoAddon => {
if (undoRedoAddon) {
undoRedoAddon.invoke(async pdfDoc => {
const pdfPage = await pdfDoc.getPageByIndex(0);
pdfPage.addAnnot({...}); // Perform document operation to be added to the undo stack.
});
} else {
console.error("UndoRedo Addon instance not found.");
}
});

◆ redo()

UndoRedoAddon::redo ( )
inline

Redoes the previously undone document operation.

Returns
Promise<void> - A Promise that resolves when the redo operation is completed.
Since
9.2.0
Example of redoing the previously undone document operation:
pdfui.getAddonInstance('UndoRedoAddon').then(undoRedoAddon => {
if (undoRedoAddon) {
undoRedoAddon.redo();
} else {
console.error("UndoRedo Addon instance not found.");
}
});

◆ undo()

UndoRedoAddon::undo ( )
inline

Undoes the last document operation.

Returns
Promise<void> - A Promise that resolves when the undo operation is completed.
Since
9.2.0
Example of undoing the last document operation:
pdfui.getAddonInstance('UndoRedoAddon').then(undoRedoAddon => {
if (undoRedoAddon) {
undoRedoAddon.undo();
} else {
console.error("UndoRedo Addon instance not found.");
}
});

◆ undoAll()

UndoRedoAddon::undoAll ( )
inline

Undoes the all document operations.

Returns
Promise<void> - A Promise that resolves when the undo operation is completed.
Since
9.2.0
Example of undoing all document operations:
pdfui.getAddonInstance('UndoRedoAddon').then(undoRedoAddon => {
if (undoRedoAddon) {
undoRedoAddon.undoAll();
} else {
console.error("UndoRedo Addon instance not found.");
}
});

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