Skip to content
Guides

Undo and Redo

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:

swift
// undo.
if pdfView.canEditTextUndo() {
    pdfView.editTextUndo()
}
// redo.
if pdfView.canEditTextRedo() {
    pdfView.editTextRedo()
}
objective-c
// undo.
if ([pdfView canEditTextUndo]) {
    [pdfView editTextUndo];
}
// redo.
if ([pdfView canEditTextRedo]) {
    [pdfView editTextRedo];
}