PdfDocumentProcessor.DeleteMarkupAnnotations(IEnumerable<PdfMarkupAnnotationData>) Method
Deletes markup annotations specified in the PdfMarkupAnnotationData collection.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Docs.v19.1.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
annotations | IEnumerable<PdfMarkupAnnotationData> | A collection of PdfMarkupAnnotationData objects that represent text markup annotations that will be deleted. |
Remarks
To delete a specific markup annotation, call the PdfDocumentProcessor.DeleteMarkupAnnotation method.
Example
This example shows how to delete all markup annotation from document pages.
To retrieve all text markup annotations in a page, call the PdfDocumentProcessor.GetMarkupAnnotationData method with a specified page number.
To delete all markup annotations, call the PdfDocumentProcessor.DeleteMarkupAnnotations
method passing the markup annotation list as an argument to this method.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-delete-all-text-markup-annotations-from-a-pdf-document-t545688
using DevExpress.Pdf;
using System.Collections.Generic;
namespace RemoveAllMarkupAnnotations {
class Program {
static void Main(string[] args) {
// Create a PDF Document Processor.
using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
// Load a document.
processor.LoadDocument("..\\..\\Document.pdf");
// Get a list of annotations in the document pages.
for (int i = 0; i <= processor.Document.Pages.Count; i++) {
IList<PdfMarkupAnnotationData> annotations = processor.GetMarkupAnnotationData(i);
// Delete all text markup annotations from document pages.
processor.DeleteMarkupAnnotations(annotations);
// Save the result document.
processor.SaveDocument("..\\..\\Result.pdf");
}
}
}
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DeleteMarkupAnnotations(IEnumerable<PdfMarkupAnnotationData>) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.