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 PDF Viewer or WPF PDF Viewer controls. 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.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.