Skip to main content

PdfDocumentProcessor.DeleteMarkupAnnotations(IEnumerable<PdfMarkupAnnotationData>) Method

Deletes markup annotations specified in the PdfMarkupAnnotationData collection.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Docs.v23.2.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public void DeleteMarkupAnnotations(
    IEnumerable<PdfMarkupAnnotationData> annotations
)

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.

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");
                }
            }
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference 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.

See Also