PdfAnnotationFacade Class
Exposes members used to organize annotations without access to their inner structure.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.2.Core.dll
NuGet Package: DevExpress.Pdf.Core
#Declaration
#Remarks
Use the PdfPageFacade.Annotations property to retrieve a list of annotation objects.
Our Annotation Facade API allows you to add, edit, add replies and reviews, flatten, and remove all available annotations. Refer to the following article for more information about annotations: Annotations in PDF Documents.
#Create Annotations
The table below lists available annotation types and API used to create these annotations. You can filter annotation properties, cast them to the corresponding class, and use class properties to modify annotation parameters.
#Flatten Annotations
Call one of the following methods to flatten an annotation:
Method | Description |
---|---|
Pdf |
Flattens document annotations. |
Pdf |
Flattens annotations of a specific page. |
Pdf |
Flattens a specific annotation. |
The code sample below flattens all text annotations in the document:
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
// Load a document:
processor.LoadDocument("..\\..\\Document.pdf");
// Flatten all text annotations:
PdfDocumentFacade documentFacade = processor.DocumentFacade;
documentFacade.FlattenAnnotations(PdfAnnotationType.Text);
// Save the result:
processor.SaveDocument("..\\..\\Result.pdf");
}
#Remove Annotations
Call the Remove() method to remove an annotation.
The code sample below removes all annotations from a specific author:
using DevExpress.Pdf;
using System.Linq;
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
// Load a document
processor.LoadDocument("..\\..\\Document.pdf");
// Access the first page properties
PdfPageFacade pageFacade = processor.DocumentFacade.Pages[0];
// Retrieve all markup annotations
var markups = pageFacade.Annotations.Where
(annotation => annotation.Type != PdfAnnotationType.Link).ToList();
foreach(PdfMarkupAnnotationFacade markupAnnotation in markups)
{
// Check the annotation author
if (markupAnnotation.Author == "Brian Zetc")
{
// Remove the annotation
markupAnnotation.Remove();
}
}
// Save the result
processor.SaveDocument("..\\..\\Result.pdf");
}