On this page
Guides
Undo and Redo
The UndoManager
class of CPDFViewer
provides undo and redo functionalities.
Undo refers to reversing previous actions and restoring the document to its previous state. After a user operates, if they find the result unsatisfactory, they can undo the step to revert to the previous state. This helps prevent data loss due to mistakes or dissatisfaction with the outcome.
Redo is a complementary feature to undo; it allows users to reapply previously undone actions, restoring the system state to its state before the undo. Redo is typically used when a user realizes that the initially undone actions were necessary after one or multiple undo steps.
This example shows how to undo and redo:
C#
// undo
if(myCPDFViewer.UndoManager.CanUndo)
{
myCPDFViewer.UndoManager.Undo();
}
// redo
if (myCPDFViewer.UndoManager.CanRedo)
{
myCPDFViewer.UndoManager.Redo();
}