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.
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
Victor Stein
Victor Stein
Does/ Will DX support other annotation types tehn stickyn otes like the following?:
  • ConnectedLines
  • Ellipse
  • EmbeddedImage
  • FreeHand
  • Line
  • LineArrow
  • Link
  • Polygon
  • Rectangle
  • Text

26 October 2021
Alex B.G. (DevExpress)
Alex B.G. (DevExpress)

@Victor Stein
We continue to develop support for annotations in our PDF Document API and desktop PDF Viewers. Our upcoming v21.2 release will extend our API and add the ability to change basic annotation properties in the viewer. The creation of annotations will be available via the API. This should work for everything on your list. We'll publish a blog post soon.

 

28 October 2021
CRM-33f27fd7-40d9-428c-8a1b-c1aa82df6956
Roel

When you right click, only Highlight, Strikethrough, and Underline is in popup menu.

Why Sticky Notes is not available? 

16 February 2022
Alex B.G. (DevExpress)
Alex B.G. (DevExpress)

Commands to add Sticky Notes in the popup menu make sense. Thank you for bringing this to our attention.
While we haven't added these commands to the popup menu yet, you can implement them yourself using the AddStickyNote methods:

- PdfViewer.AddStickyNote (Winforms)

- PdfViewerControl.AddStickyNote (WPF)

Please refer to these examples to learn how to add a custom item to the popup menu:

- PDF Viewer for Winforms - How to add a custom bar button item to the popup menu

- PDF Viewer for WPF - How to customize of hide the popup menu

Also feel free to contact DevExpress Support Team via the DevExpress Support Center should you require additional assistance.

 

 

17 February 2022

Please login or register to post comments.