officefileapi-devexpress-dot-pdf-dot-pdfmarkupannotationfacade-dot-addreply-x28-system-dot-string-system-dot-string-x29.md
Adds a comment to the document annotation.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfMarkupAnnotationComment AddReply(
string author,
string contents
)
Public Function AddReply(
author As String,
contents As String
) As PdfMarkupAnnotationComment
| Name | Type | Description |
|---|---|---|
| author | String |
The comment’s author.
| | contents | String |
The comment’s text.
|
| Type | Description |
|---|---|
| PdfMarkupAnnotationComment |
The annotation comment.
|
The code sample below adds two nested comments to all sticky notes (the document in opened in WinForms PDF Viewer):
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";
}
Using processor As New PdfDocumentProcessor()
' Load a document
processor.LoadDocument("..\..\Document.pdf")
' Access the first page properties
Dim pageFacade As PdfPageFacade = processor.DocumentFacade.Pages(0)
' Retrieve all text annotations
Dim stickyNotes = pageFacade.Annotations.Where
(Function(annotation) annotation.Type = PdfAnnotationType.Text)
For Each stickyNote As PdfTextAnnotationFacade In stickyNotes
' Add comments
AddAnnotationComments(stickyNote)
Next stickyNote
' Save the result
processor.SaveDocument("..\..\Result.pdf")
End Using
private static void AddAnnotationComments(PdfMarkupAnnotationFacade annotation)
Dim comment As PdfMarkupAnnotationComment = annotation.AddReply("Reviewer", "Done")
comment.Subject = "Proofread"
Dim nestedComment As PdfMarkupAnnotationComment = comment.AddReply(annotation.Author, "Thanks")
nestedComment.Subject = "Reviewed"
See Also
PdfMarkupAnnotationFacade Class