Skip to content
ComPDF
DemoAPI ReferenceFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Guides

Undo and Redo

Content editing supports Undo and Redo, allowing users to easily revert or restore actions during editing.

Toolbar Actions

Users can directly tap the Undo/Redo buttons on the bottom toolbar.

API Calls

Developers can use the historyManager to implement custom undo/redo logic.

Set Callbacks

tsx
const manager = pdfReaderRef.current._editManager;
const historyManager = manager.historyManager;

// Set a callback to monitor history state changes
historyManager.setOnHistoryStateChangedListener((pageIndex, canUndo, canRedo) => {
});

// Undo
if (await historyManager.canUndo()) {
  await historyManager.undo();
}

// Redo
if (await historyManager.canRedo()) {
  await historyManager.redo();
}