public final class StampAnnotation
extends PdfAnnotation



Represents a stamp annotation in a PDF document.

Only path, image, or text objects created using the PdfPagePathObject, PdfPageImageObject, or PdfPageTextObject constructors respectively can be added to a stamp annotation.

Summary

Public constructors

StampAnnotation(RectF bounds)

Creates a new stamp annotation with the specified bounds.

Public methods

void addObject(PdfPageObject pageObject)

Adds a PDF page object to the stamp annotation.

RectF getBounds()

Returns the bounding rectangle of the stamp annotation.

List<PdfPageObject> getObjects()

Returns all the known PDF page objects in the stamp annotation.

void removeObject(int index)

Remove the page object at the given index inside the stamp annotation.

void setBounds(RectF bounds)

Sets the bounding rectangle of the stamp annotation.

Inherited methods

From class android.graphics.pdf.component.PdfAnnotation

int getPdfAnnotationType()

Returns the type of the annotation.

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

StampAnnotation

public StampAnnotation (RectF bounds)

Creates a new stamp annotation with the specified bounds.

The list of page objects inside the stamp annotation will be empty by default

Parameters
bounds RectF: The bounding rectangle of the annotation.
This value cannot be null.

Public methods

addObject

public void addObject (PdfPageObject pageObject)

Adds a PDF page object to the stamp annotation.

The page object should be a path, text or an image.

Parameters
pageObject PdfPageObject: The PDF page object to add.
This value cannot be null.
Throws
IllegalArgumentException if the page object is already added to a page or an annotation.

getBounds

public RectF getBounds ()

Returns the bounding rectangle of the stamp annotation.

Returns
RectF The bounding rectangle.
This value cannot be null.

getObjects

public List<PdfPageObject> getObjects ()

Returns all the known PDF page objects in the stamp annotation.

Returns
List<PdfPageObject> The list of page objects in the annotation.
This value cannot be null.

removeObject

public void removeObject (int index)

Remove the page object at the given index inside the stamp annotation. Here index is the index of the page object in the list of page objects returned by getObjects()

Parameters
index int: - index of the object to be removed.
Value is 0 or greater
Throws
IllegalArgumentException if there is no object in the annotation with the given id

setBounds

public void setBounds (RectF bounds)

Sets the bounding rectangle of the stamp annotation.

Parameters
bounds RectF: The new bounding rectangle.
This value cannot be null.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-13 UTC.