Skip to main content
All docs
.NET Framework 4.5.2+

PdfPageFacade.Annotations Property

Returns all page annotation properties.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.1.Core.dll

NuGet Package: DevExpress.Pdf.Core


public IReadOnlyList<PdfAnnotationFacade> Annotations { get; }

Property Value

Type Description

A list of objects that contain annotation properties.


The Annotations property retrieves all page annotation properties. Use the PdfDocumentFacade.Pages property to access the PdfPageFacade class.

You can filter annotation properties, cast them to the corresponding class, and use class properties to modify annotation parameters.

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:

Annotation Class Method
Link PdfLinkAnnotationFacade PdfPageFacade.AddLinkAnnotation
Text Markup PdfTextMarkupAnnotationFacade PdfPageFacade.AddTextMarkupAnnotation
Sticky Note PdfTextAnnotationFacade PdfPageFacade.AddTextAnnotation
Caret PdfCaretAnnotationFacade PdfPageFacade.AddCaretAnnotation
Rubber Stamp PdfRubberStampAnnotationFacade PdfPageFacade.AddRubberStampAnnotation
Circle PdfCircleAnnotationFacade PdfPageFacade.AddCircleAnnotation
Square PdfSquareAnnotationFacade PdfPageFacade.AddSquareAnnotation
File Attachment PdfFileAttachmentAnnotationFacade PdfPageFacade.AddFileAttachmentAnnotation
Free Text PdfFreeTextAnnotationFacade PdfPageFacade.AddFreeTextAnnotation
Ink PdfInkAnnotationFacade PdfPageFacade.AddInkAnnotation
Line PdfLineAnnotationFacade PdfPageFacade.AddLineAnnotation
Polyline PdfPolyLineAnnotationFacade PdfPageFacade.AddPolyLineAnnotation
Polygon PdfPolygonAnnotationFacade PdfPageFacade.AddPolygonAnnotation

The code sample below creates a rubber stamp, file attachment, free text, and a circle annotation:

markup annotations

using DevExpress.Pdf;
using System;
using System.IO;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    // Load a document

    // Access the first page properties
    PdfPageFacade pageFacade = processor.DocumentFacade.Pages[0];

    // Define a rubber stamp rectangle
    PdfRectangle rubberStampRectangle = new PdfRectangle(663, 526, 763, 576);

    // Create a "Draft" rubber stamp annotation
    PdfRubberStampAnnotationFacade rubberStamp =
    rubberStamp.Author = "Jesse Faden";
    rubberStamp.Contents = "Made in PDF Document API";

    // Define a file attachment area
    PdfPoint attachmentPoint = new PdfPoint(52, 550);

    // Specify attachment data
    PdfFileAttachment attachment = new PdfFileAttachment()
        CreationDate = DateTime.Now,
        Description = "This is my attached file",
        FileName = "MyAttach.txt",
        Data = File.ReadAllBytes("..\\..\\FileToAttach.txt")

    // Create a file attachment annotation
    PdfFileAttachmentAnnotationFacade pdfFileAttachment =
        pageFacade.AddFileAttachmentAnnotation(attachmentPoint, attachment,
    pdfFileAttachment.Author = "Nancy Skywalker";
    pdfFileAttachment.Contents = "Additional Content";

    // Specify a free text annotation area
    PdfRectangle freeTextRectangle = new PdfRectangle(14, 321, 145, 340);

    // Create a free text annotation in this area
    PdfFreeTextAnnotationFacade freeTextAnnotation =
       pageFacade.AddFreeTextAnnotation(freeTextRectangle, "Free Text Annotation");
    freeTextAnnotation.Author = "Rayn Anita W";

    // Add a callout line
    freeTextAnnotation.SetCallout(PdfAnnotationLineEndingStyle.OpenArrow, new PdfPoint(152,351));

    // Find the target phrase in the document
    string circleText = "dogfooded";
    PdfTextSearchResults searchResults = processor.FindText(circleText);

    if (searchResults.Status == PdfTextSearchStatus.Found)
        // Define an area around the phrase to add an annotation
        PdfRectangle circleRectangle = searchResults.Rectangles[0].BoundingRectangle;

        // Create a circle annotation in this area
        PdfCircleAnnotationFacade circleAnnotation = pageFacade.AddCircleAnnotation(circleRectangle);
        circleAnnotation.Author = "Cardle Anita W";
        circleAnnotation.Contents = "It's better to say 'used' in this case";

    // Save the result

Flatten Annotations

Call one of the following methods to flatten an annotation:

Method Description
PdfDocumentFacade.FlattenAnnotations Flattens document annotations.
PdfPageFacade.FlattenAnnotations Flattens annotations of a specific page.
PdfAnnotationFacade.Flatten() Flattens a specific annotation.

The code sample below flattens all annotations that are located on the lower half of the first page:

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
  // Load a document
  PdfPageFacade pageFacade = processor.DocumentFacade.Pages[0];

  // Flatten annotations located
  // on the lower half of the first page
  double halfPage = processor.Document.Pages[0].CropBox.Top / 2;
  pageFacade.FlattenAnnotations(x => x.Rectangle.Top < halfPage);

  // Save the result

Remove Annotations

Call the PdfAnnotationFacade.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

    // 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
    // Save the result
See Also