officefileapi-devexpress-dot-pdf-dot-pdfdocumentprocessor-dot-deletemarkupannotations-x28-system-dot-collections-dot-generic-dot-ienumerable-devexpress-dot-pdf-dot-pdfmarkupannotationdata-x29.md
Deletes markup annotations specified in the PdfMarkupAnnotationData collection.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public void DeleteMarkupAnnotations(
IEnumerable<PdfMarkupAnnotationData> annotations
)
Public Sub DeleteMarkupAnnotations(
annotations As IEnumerable(Of PdfMarkupAnnotationData)
)
| Name | Type | Description |
|---|---|---|
| annotations | IEnumerable<PdfMarkupAnnotationData> |
A collection of PdfMarkupAnnotationData objects that represent text markup annotations that will be deleted.
|
To delete a specific markup annotation, call the PdfDocumentProcessor.DeleteMarkupAnnotation method.
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");
}
}
}
}
}
Imports DevExpress.Pdf
Imports System.Collections.Generic
Namespace RemoveAllMarkupAnnotations
Friend Class Program
Shared Sub Main(ByVal args() As String)
' Create a PDF Document Processor.
Using processor As New PdfDocumentProcessor()
' Load a document.
processor.LoadDocument("..\..\Document.pdf")
' Get a list of annotations in the document pages.
For i As Integer = 0 To processor.Document.Pages.Count
Dim annotations As IList(Of PdfMarkupAnnotationData) = processor.GetMarkupAnnotationData(i)
' Delete all text markup annotations from document pages.
processor.DeleteMarkupAnnotations(annotations)
' Save the result document.
processor.SaveDocument("..\..\Result.pdf")
Next i
End Using
End Sub
End Class
End Namespace
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.
pdf-document-api-manage-annotations-in-document/CS/CreateMarkupAnnotation/Program.cs#L103
//Borman Aaron Lewis's markup annotations from a page.
processor.DeleteMarkupAnnotations(processor.GetMarkupAnnotationData(i)
.Where(annotation => annotation.Author.Contains("Borman Aaron Lewis")));
pdf-document-api-manage-annotations-in-document/VB/CreateMarkupAnnotation/Program.vb#L81
'Borman Aaron Lewis's markup annotations from a page.
processor.DeleteMarkupAnnotations(processor.GetMarkupAnnotationData(i).Where(Function(annotation) annotation.Author.Contains("Borman Aaron Lewis")))
Next
See Also