Skip to content
DemoFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub
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 area
    • CPDFEditImageArea: Image edit area
    • CPDFEditArea with type == CPDFEditAreaType.path: Path edit area

Example:

dart
// Listen for edit selection events and delete the selected edit area
controller.addEventListener(CPDFEvent.editorSelectionSelected, (event) async {
  if (event is CPDFEditArea) {
    await document.removeEditArea(event);
  }
});

// Directly delete a specified edit area
await document.removeEditArea(editArea);