---
title: "Adding stamp annotations to a PDF document | Nutrient Java SDK"
canonical_url: "https://www.nutrient.io/guides/java/editor/add-stamp-annotations-to-pdf/"
md_url: "https://www.nutrient.io/guides/java/editor/add-stamp-annotations-to-pdf.md"
last_updated: "2026-05-30T02:20:01.337Z"
description: "How to add stamp annotations to a PDF using Nutrient Java SDK."
---

# Adding stamp annotations to a PDF document

Use stamp annotations to mark document status in PDF workflows.

Common use cases include:

- Approval and rejection workflows

- Draft and final state marking

- Confidentiality labeling

- Review tracking across document stages

In this guide, you’ll add:

- Default and custom stamp styles

- Color-customized stamps

- Multiple status stamps on one page

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

## How Nutrient helps

Nutrient Java SDK handles stamp annotation structures and appearance generation.

The SDK handles:

- Parsing stamp annotation dictionaries and rubber stamp icon rendering

- Managing predefined stamp appearance streams and text positioning

- Handling stamp style enumeration and icon resource loading

- Complex annotation appearance states and color transformations

## Complete implementation

This example adds multiple stamp annotations to a PDF:

```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.PdfStampAnnotation;
import io.nutrient.sdk.enums.PdfRubberStampIcon;

public class StampAnnotations {

```

Create the `main` method as the sample entry point:

```java

    public static void main(String[] args) {

```

## Working with stamp annotations

Open the document with try-with-resources, create an editor, and ensure one page exists:

```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 basic stamp

Add a stamp with `addStamp(x, y, width, height, author, contents)`.

In this sample:

- The position is `(400, 700)`.

- The size is `150 × 50`.

- The default style is `Draft`.

- The default color is red (`ARGB 255, 255, 0, 0`).

```java

            PdfStampAnnotation draftStamp = annotations.addStamp(
                400.0f, 700.0f, 150.0f, 50.0f,  // x, y, width, height
                "Author",
                "Work in progress"
            );

```

## Adding an approved stamp

Add a second stamp and customize its style.

In this sample:

- The position is `(400, 600)`.

- `setStampStyle(PdfRubberStampIcon.Approved)` sets the approved icon.

- `setColor(...)` sets the green color.

```java

            PdfStampAnnotation approvedStamp = annotations.addStamp(
                400.0f, 600.0f, 150.0f, 50.0f,  // x, y, width, height
                "Approver Name",
                "Document approved on review"
            );
            // Customize the stamp appearance
            approvedStamp.setStampStyle(PdfRubberStampIcon.Approved);
            approvedStamp.setColor(Color.fromArgb(255, 0, 128, 0));

```

## Adding a confidential stamp

Add a confidentiality stamp and set its icon style.

In this sample:

- The position is `(400, 500)`.

- `setStampStyle(PdfRubberStampIcon.Confidential)` applies the confidential icon.

- The default red color remains unless changed.

```java

            PdfStampAnnotation confidentialStamp = annotations.addStamp(
                400.0f, 500.0f, 150.0f, 50.0f,  // x, y, width, height
                "Security Officer",
                "Contains sensitive information"
            );
            // Customize the stamp appearance
            confidentialStamp.setStampStyle(PdfRubberStampIcon.Confidential);

```

## Other available stamp types

Use other `PdfRubberStampIcon` values to represent additional states.

This sample adds:

- A `NotApproved` stamp at `(50, 700)`.

- A `Final` stamp at `(50, 600)` with the color blue.

```java

            // Not Approved stamp
            PdfStampAnnotation notApprovedStamp = annotations.addStamp(
                50.0f, 700.0f, 150.0f, 50.0f,  // x, y, width, height
                "Reviewer",
                "Rejected"
            );
            notApprovedStamp.setStampStyle(PdfRubberStampIcon.NotApproved);

            // Final stamp
            PdfStampAnnotation finalStamp = annotations.addStamp(
                50.0f, 600.0f, 150.0f, 50.0f,  // x, y, width, height
                "Legal",
                "Final version"
            );
            finalStamp.setStampStyle(PdfRubberStampIcon.Final);
            finalStamp.setColor(Color.fromArgb(255, 0, 0, 255));

```

## Saving the document

Save the output PDF and close the editor:

```java

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

```

## Conclusion

Use this workflow to add stamp annotations:

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 stamp annotations with the default `Draft` style and red color.

5. Customize stamp styles using `setStampStyle()` with `PdfRubberStampIcon` enumeration values.

6. Customize stamp colors using `setColor()` with ARGB color values.

7. Add `Approved` stamps with green color for approval workflows.

8. Add `Confidential` stamps for marking sensitive documents.

9. Add `NotApproved` stamps for rejection indicators.

10. Add `Final` stamps to mark completed documents.

11. Save and close the editor.

For related annotation workflows, refer to the [Java SDK guides](https://www.nutrient.io/guides/java.md).
---

## Related pages

- [Adding link annotations to a PDF document](/guides/java/editor/add-link-annotations-to-pdf.md)
- [Adding interactive form fields to a PDF document](/guides/java/editor/add-form-fields-to-pdf.md)
- [Adding shape annotations to a PDF document](/guides/java/editor/add-shape-annotations-to-pdf.md)
- [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 redaction annotations to a PDF document](/guides/java/editor/add-redaction-annotations-to-pdf.md)
- [Adding free text annotations to a PDF document](/guides/java/editor/add-freetext-annotations-to-pdf.md)
- [Adding sticky note annotations to a PDF document](/guides/java/editor/add-sticky-note-annotations-to-pdf.md)
- [Adding text markup annotations to a PDF document](/guides/java/editor/add-text-markup-annotations-to-pdf.md)
- [Adding invisible digital signatures to a PDF document](/guides/java/editor/add-invisible-signature-to-pdf.md)
- [Editing PDF form fields](/guides/java/editor/editing-pdf-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)
- [Nutrient Java SDK editor guides](/guides/java/editor.md)
- [Detecting and adding form fields to a PDF document](/guides/java/editor/detect-and-add-form-fields.md)
- [Managing PDF page order](/guides/java/editor/manage-pdf-page-order.md)
- [Editing PDF metadata with Nutrient Java SDK](/guides/java/editor/editing-pdf-metadata.md)
- [Filling PDF form fields](/guides/java/editor/fill-pdf-form.md)
- [Merging PDFs](/guides/java/editor/merge-pdf-into-other-pdf.md)

