Guides
Delete Text and Images
ComPDF Flutter SDK provides convenient APIs to delete text and image content.
This method is used to delete an edit area (text area, image area, or path area) from a document. It is typically used in conjunction with edit selection events, allowing users to select and delete specific edit content.
Parameters:
editArea: The edit area object to delete, which can be one of the following types:CPDFEditTextArea: Text edit areaCPDFEditImageArea: Image edit areaCPDFEditPathArea: Path edit area
Example:
dart
// Listen for edit selection events and delete the selected edit area
controller.addEventListener(CPDFEvent.editorSelectionSelected, (event) {
if (event is CPDFEditTextArea ||
event is CPDFEditImageArea ||
event is CPDFEditPathArea) {
document.removeEditArea(event);
}
});
// Directly delete a specified edit area
document.removeEditArea(editArea);