PDF – Sticky Notes and Comments

Office-Inspired Products
17 November 2020

As you may already know, our most recent release (v20.2) includes a couple of highly requested features for our .NET PDF product libraries. Both our .NET PDF Document API and our PDF Viewer (for WinForms and WPF) now support sticky notes (sticky notes represent text annotations linked to contents within a PDF document). PDF documents that include sticky notes can be printed and exported as necessary.

.NET PDF Document API

Our PDF Document API v20.2 allows you to:

  • Create sticky notes
  • Change sticky note parameters
  • Add replies (including nested responses) and review status for a specific annotation

The following code sample illustrates the ease with which you can create a sticky note in code, specify its parameters, add a reply, and review status:

using DevExpress.Pdf;
//...
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    //Load document:
    processor.LoadDocument("..\\..\\Document.pdf");

    //Add sticky note on the first page:
    PdfTextAnnotationData textAnnotation = processor.AddTextAnnotation(1, new PdfPoint(100, 300));

    //Specify sticky note parameters:
    textAnnotation.Author = "Nancy Davolio";
    textAnnotation.Checked = true;
    textAnnotation.Color = new PdfRGBColor(0.8, 0.2, 0.1);
    textAnnotation.Contents = "Please proofread this document";
    textAnnotation.IconName = PdfTextAnnotationIconName.Check;

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

PDF Viewer (for WinForms and WPF)

You can now create sticky notes in code or via our WinForms or WPF PDF Viewer’s UI. To create a sticky note using our PDF Viewer UI, select the Sticky Note tool in the Comment ribbon group and place the sticky note within the document. Specify the desired annotation color and opacity within the drop-down menu.

Call the PdfViewer.AddStickyNote (or PdfViewerControl.AddStickyNote for WPF) method to create a sticky note in code:

pdfViewer.AddStickyNote(new PdfDocumentPosition(1, new PdfPoint(29, 568)), "Comment", Color.Crimson);

You can handle the following PDF Viewer events to manage multiple sticky note-related actions:

  • AnnotationCreating
  • AnnotationCreated
  • AnnotationGotFocus
  • AnnotationLostFocus
  • AnnotationChanged
  • AnnotationDeleting
  • AnnotationDeleted (WPF)

Please note that we renamed existing events and changed associated event arguments to process these events in response to sticky note actions. Please refer to the following breaking change document for more information: T924471

Our PDF Viewers (for WinForms and WPF) now ship with an integrated Comments pane. This pane displays all markup annotations and related comments. You can sort, filter, and show annotations with a specific text string as needed.

When you select an annotation within the pane, the Reply editor is activated. Enter text in the editor and click Reply to add a response to the annotation. Double-click the annotation to edit its contents.

Right-click an annotation and select Set Status to specify the annotation or response review status.

Your Feedback Matters

As always, we welcome your thoughts. Please comment below and let us know what you think about our sticky notes implementation. Should you have technical questions, feel free to contact us via the DevExpress Support Center.

Showcase Your Apps on DevExpress.com

Highlight your business app and share your development experiences with the DevExpress community. To include your app in our upcoming App Showcase, please forward an application screenshot to clientservices@devexpress.com and tell us which DevExpress products you currently use within your organization.
3 comment(s)
Jim Foye
Jim Foye
We're getting ready to license (at high cost) a PDF viewer codebase written in C++, because the DevExpress viewer was just way too slow.
17 November 2020
Neven
Neven
Is there any way to export comments into separate file and load it back into pdf as needed?
19 November 2020
Alex B.G. (DevExpress)
Alex B.G. (DevExpress)
@Neven
Our components don't have an API to export comments into a separate file out of the box.
But, you can implement it yourself using our PDF Document API. The following article should be of help:
https://docs.devexpress.com/OfficeFileAPI/DevExpress.Pdf.PdfMarkupAnnotationData.

Note: This API requires our Universal or Office File API subscription. If you have any other questions, please feel free to contact our Support Team. We will be happy to help you.

19 November 2020

Please login or register to post comments.