---
title: "Adding sticky note annotations to a PDF document | Nutrient Java SDK"
canonical_url: "https://www.nutrient.io/guides/java/editor/add-sticky-note-annotations-to-pdf/"
md_url: "https://www.nutrient.io/guides/java/editor/add-sticky-note-annotations-to-pdf.md"
last_updated: "2026-06-09T10:26:34.600Z"
description: "How to add sticky note annotations to a PDF using Nutrient Java SDK."
---

# Adding sticky note annotations to a PDF document

Adding sticky note annotations to PDFs programmatically enables teams to automate document review workflows, build commenting systems, and implement collaborative feedback pipelines. Whether you’re creating automated review comments, building document feedback tools, implementing quality assurance workflows, creating annotation systems for technical reviews, or building collaborative editing platforms, sticky note annotations provide icon-based comment markers that display text content when clicked. Unlike free text annotations that render text directly on the page, sticky note annotations appear as compact icons that expand to show full comment content, conserving page space while enabling detailed feedback.

[Download sample](https://www.nutrient.io/downloads/samples/java/add-sticky-note-annotations-to-pdf.zip)

## How Nutrient helps you achieve this

Nutrient Java SDK handles PDF sticky note annotation structures and appearance generation. With the SDK, you don’t need to worry about:

- Parsing text annotation dictionaries and popup window configurations

- Managing sticky note icon styles and appearance states

- Handling annotation author metadata and timestamp formatting

- Complex annotation popup positioning and content rendering

Instead, Nutrient provides an API that handles all the complexity behind the scenes, letting you focus on your business logic.

## Complete implementation

Below is a complete working example that demonstrates adding sticky note annotations with various colors to a PDF. The following lines set up the Java application. The package declaration and import statements bring in all necessary classes from the Nutrient SDK:

```java

package io.nutrient.Sample;

import io.nutrient.sdk.Document;
import io.nutrient.sdk.types.Color;
import io.nutrient.sdk.editors.PdfEditor;
import io.nutrient.sdk.editors.pdf.pages.PdfPageCollection;
import io.nutrient.sdk.editors.pdf.pages.PdfPage;
import io.nutrient.sdk.editors.pdf.annotations.PdfAnnotationCollection;
import io.nutrient.sdk.editors.pdf.annotations.PdfTextAnnotation;

public class StickyNoteAnnotations {

```

The `main` method defines the entry point that will contain the sticky note annotation creation logic:

```java

    public static void main(String[] args) {

```

## Working with sticky note annotations

The `Document.open()` call opens the PDF document. The try-with-resources statement ensures the document is automatically closed when you’re done, preventing resource leaks. The following code creates a PDF editor, accesses the page collection, ensures at least one page exists by adding a letter-size page (612×792 points) if the document is empty, and retrieves the annotation collection from the first page:

```java

        try (Document document = Document.open("input.pdf")) {
            PdfEditor editor = PdfEditor.edit(document);
            PdfPageCollection pages = editor.getPageCollection();

            if (pages.getCount() == 0) {
                pages.add(612.0f, 792.0f);
            }

            PdfPage page = pages.getFirst();
            PdfAnnotationCollection annotations = page.getAnnotationCollection();

```

## Adding a sticky note annotation

The following code adds a sticky note annotation at coordinates (100, 700). The `addStickyNote()` method creates a sticky note icon with position parameters (x, y), author name, subject line, and detailed contents text. Sticky note annotations are created with a default yellow color (ARGB: 255, 255, 255, 0) and render as a compact icon that expands to display a popup window containing the subject and contents when clicked. The icon position (100, 700) places it near the top-left area of the page, making it visible for reviewers while not obscuring important content:

```java

            PdfTextAnnotation stickyNote = annotations.addStickyNote(
                100.0f, 700.0f,
                "Review Author",
                "Clarification Needed",
                "This section needs clarification. Please add more details about the implementation."
            );

```

## Adding multiple sticky notes

The following code demonstrates adding multiple sticky notes with customized colors to categorize comment types. The first sticky note is positioned at coordinates (100, 600) and customized with a red color using ARGB values (255, 255, 0, 0) via the `setColor()` method. Red sticky notes are commonly used for urgent issues, blocking problems, or critical feedback requiring immediate attention. The second sticky note is positioned at coordinates (100, 500) and customized with a green color using ARGB values (255, 0, 255, 0). Green sticky notes are commonly used for approval indicators, positive feedback, or resolved issues. The vertical spacing of 100 points between notes (700, 600, 500) prevents icon overlap while keeping all comments visible in the same page region:

```java

            PdfTextAnnotation urgentNote = annotations.addStickyNote(
                100.0f, 600.0f,
                "Reviewer",
                "Urgent Issue",
                "This issue must be addressed before release."
            );
            // Optionally customize the color
            urgentNote.setColor(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.setColor(Color.fromArgb(255, 0, 255, 0));

```

## Saving the document

The final code block saves the document with all sticky note annotations and closes the editor:

```java

            editor.saveAs("output.pdf");
            editor.close();
        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
            e.printStackTrace();
        }
    }
}

```

## Conclusion

The sticky note annotation workflow consists of several key operations:

1. Open the document and create an editor.

2. Access the page collection and ensure at least one page exists.

3. Retrieve the annotation collection for the target page.

4. Add basic sticky note annotations with default yellow color at specified coordinates.

5. Specify author, subject, and detailed contents for each sticky note.

6. Customize sticky note colors using `setColor()` with ARGB values for categorization.

7. Use red sticky notes for urgent issues and critical feedback.

8. Use green sticky notes for approvals and positive feedback.

9. Position sticky notes with appropriate vertical spacing to prevent icon overlap.

10. Save and close the editor.

Nutrient handles text annotation dictionary structures, popup window configurations, sticky note icon rendering, and appearance state management so you don’t need to understand PDF text annotation specifications or manage annotation popup positioning manually. The sticky note annotation system provides compact icon-based comment markers for document review workflows, collaborative feedback systems, quality assurance processes, and technical review platforms where detailed comments need to be attached to specific page locations without obscuring document content.

---

## Related pages

- [Adding annotations to a PDF document](/guides/java/editor/add-annotations-to-pdf.md)
- [Adding a custom page to a PDF document](/guides/java/editor/add-custom-page-to-pdf.md)
- [Adding interactive form fields to a PDF document](/guides/java/editor/add-form-fields-to-pdf.md)
- [Adding invisible digital signatures to a PDF document](/guides/java/editor/add-invisible-signature-to-pdf.md)
- [Adding free text annotations to a PDF document](/guides/java/editor/add-freetext-annotations-to-pdf.md)
- [Adding link annotations to a PDF document](/guides/java/editor/add-link-annotations-to-pdf.md)
- [Adding shape annotations to a PDF document](/guides/java/editor/add-shape-annotations-to-pdf.md)
- [Adding stamp annotations to a PDF document](/guides/java/editor/add-stamp-annotations-to-pdf.md)
- [Adding text markup annotations to a PDF document](/guides/java/editor/add-text-markup-annotations-to-pdf.md)
- [Detecting and adding form fields to a PDF document](/guides/java/editor/detect-and-add-form-fields.md)
- [Adding visible digital signatures to a PDF document](/guides/java/editor/add-visible-signature-to-pdf.md)
- [Advanced digital signature workflows](/guides/java/editor/advanced-digital-signatures.md)
- [Adding redaction annotations to a PDF document](/guides/java/editor/add-redaction-annotations-to-pdf.md)
- [Editing PDF form fields](/guides/java/editor/editing-pdf-form-fields.md)
- [Editing PDF metadata with Nutrient Java SDK](/guides/java/editor/editing-pdf-metadata.md)
- [Merging PDFs](/guides/java/editor/merge-pdf-into-other-pdf.md)
- [Filling PDF form fields](/guides/java/editor/fill-pdf-form.md)
- [Nutrient Java SDK editor guides](/guides/java/editor.md)
- [Managing PDF page order](/guides/java/editor/manage-pdf-page-order.md)

