Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfMarkupAnnotationFacade.AddReply(String, String) Method

Adds a comment to the document annotation.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

#Declaration

public PdfMarkupAnnotationComment AddReply(
    string author,
    string contents
)

#Parameters

Name Type Description
author String

The comment’s author.

contents String

The comment’s text.

#Returns

Type Description
PdfMarkupAnnotationComment

The annotation comment.

#Example

The code sample below adds two nested comments to all sticky notes (the document in opened in WinForms PDF Viewer):

added comments

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 text annotations
    var stickyNotes = pageFacade.Annotations.Where
            (annotation => annotation.Type == PdfAnnotationType.Text);
    foreach (PdfTextAnnotationFacade stickyNote in stickyNotes)
    {
        // Add comments
        AddAnnotationComments(stickyNote);
    }

    // Save the result
    processor.SaveDocument("..\\..\\Result.pdf");
}

private static void AddAnnotationComments(PdfMarkupAnnotationFacade annotation)
{
    PdfMarkupAnnotationComment comment =
       annotation.AddReply("Reviewer", "Done");
    comment.Subject = "Proofread";

    PdfMarkupAnnotationComment nestedComment =
       comment.AddReply(annotation.Author, "Thanks");
    nestedComment.Subject = "Reviewed";
}
See Also