Adding sticky note annotations to a PDF document
Use sticky note annotations to add comment markers to PDF files.
Common use cases include:
- Review workflows
- Team feedback and commenting systems
- Quality assurance notes
- Collaborative document editing
Sticky notes appear as icons on the page. Users can open each icon to read the full comment text.
Download sampleHow Nutrient helps
Nutrient .NET SDK handles sticky note annotation structures and appearance generation.
The SDK handles:
- Text annotation dictionaries and popup configuration
- Sticky note icon styles and appearance states
- Author metadata and timestamp formatting
- Popup positioning and content rendering
Complete implementation
This example adds sticky note annotations with different colors:
using Nutrient;Working with sticky note annotations
Open the document with using statements(opens in a new tab) so resources are cleaned up after processing.
Then:
- Create a PDF editor.
- Get the page collection.
- Add a letter-size page (
612 × 792) if the document is empty. - Get the annotation collection from the first page.
try{ using Document document = Document.Open("input.pdf"); using PdfEditor editor = PdfEditor.Edit(document); PdfPageCollection pages = editor.PageCollection;
if (pages.Count == 0) { pages.Add(612.0f, 792.0f); }
PdfPage page = pages.First ?? throw new InvalidOperationException("The document has no pages."); PdfAnnotationCollection annotations = page.AnnotationCollection;Adding a sticky note annotation
Add a note with AddStickyNote(x, y, author, subject, contents).
In this sample:
- The position is
(100, 700). - The metadata includes author and subject.
- The contents store the full comment text.
- The default note color is yellow.
PdfTextAnnotation stickyNote = annotations.AddStickyNote( 100.0f, 700.0f, "Review Author", "Review Comment", "This section needs clarification. Please add more details about the implementation." );Adding multiple sticky notes
Add multiple notes and use color to indicate status.
This sample:
- Adds an urgent note at
(100, 600)and sets it to red - Adds an approval note at
(100, 500)and sets it to green - Uses vertical spacing to prevent icon overlap
PdfTextAnnotation urgentNote = annotations.AddStickyNote( 100.0f, 600.0f, "Reviewer", "Urgent", "This issue must be addressed before release." ); // Optionally customize the color urgentNote.Color = Color.FromArgb(255, 255, 0, 0);
PdfTextAnnotation approvalNote = annotations.AddStickyNote( 100.0f, 500.0f, "Approver", "Approved", "This section looks good." ); // Optionally customize the color approvalNote.Color = Color.FromArgb(255, 0, 255, 0);Saving the document
Save the output PDF.
The catch block catches NutrientException if processing fails:
editor.SaveAs("output.pdf"); Console.WriteLine("Successfully saved output.pdf");}catch (NutrientException e){ Console.Error.WriteLine($"Error: {e.Message}"); Environment.Exit(1);}Conclusion
Use this workflow to add sticky note annotations:
- Open the document with
usingstatements for automatic resource cleanup. - Create an editor and access the page collection.
- Ensure at least one page exists by adding a letter-size page if needed.
- Retrieve the annotation collection from the target page.
- Add sticky note annotations with coordinates, author, subject, and contents using
AddStickyNote(). - Sticky notes appear as compact icons that expand into popup windows when clicked.
- Customize colors using the
Colorproperty with ARGB values for color categorization. - Use 100-point vertical spacing between annotations to prevent icon overlap.
- Implement color categorization workflows (red for urgent, green for approved, yellow for standard).
- Save the document — the
usingstatements release the native handles.
For related annotation workflows, refer to the .NET SDK annotation guides.