public class

StampAnnotation

extends Annotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.StampAnnotation

Class Overview

Represents a stamp or annotationBitmap annotation on the page.

Summary

Nested Classes
enum StampAnnotation.StampType This enum contains standard supported stamp types. 
[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Constructors
StampAnnotation(int pageIndex, RectF rect, byte[] compressedBitmap)
Creates a new stamp annotation with the passed bitmap as contents.
StampAnnotation(int pageIndex, RectF rect, Bitmap bitmap)
Creates a new stamp annotation with the passed bitmap as contents.
StampAnnotation(int pageIndex, RectF rect, StampAnnotation.StampType stampType)
Creates a new standard stamp annotation.
StampAnnotation(int pageIndex, RectF rect, String subject)
Creates a new stamp with custom subject.
Public Methods
void adjustBoundsForRotation()
This adjusts the annotations bounding box to the smallest possible size that will encompass the rotated annotations at it's default size.
synchronized Bitmap getBitmap()
Returns a bitmap from this stamp annotation if there is any.
String getLocalizedSubject()
Localized subject is the customized text replacing the default subject text from a StampAnnotation.StampType.
Size getMinimumSize()
Returns the minimum size of the annotation.
int getRotation()
Returns the clockwise rotation of this stamp in degrees.
StampAnnotation.StampType getStampType()
Returns type of this stamp if it's one of the standard types listed in StampAnnotation.StampType.
String getSubtext()
Returns text in second line of the stamp if any is available.
AnnotationType getType()
Gets the annotation type of the annotation.
boolean hasBitmap()
Checks whether annotation is an annotationBitmap annotation.
synchronized void setBitmap(Bitmap bitmap)
Sets a custom bitmap for this stamp annotation.
synchronized void setBitmap(byte[] compressedBitmap)
Sets a custom bitmap for this stamp annotation.
void setLocalizedSubject(String localizedSubject)
Sets localized text to be displayed instead of default subject of a StampAnnotation.StampType.
void setRotation(int rotation, boolean adjustBounds)
Sets the rotation of this stamp.
void setRotation(int rotation, Size contentSize)
Sets the rotation of this stamp.
void setRotation(int rotation, Size contentSize, boolean adjustBounds)
Sets the rotation of this stamp.
void setRotation(int rotation)
Sets the rotation of this stamp.
synchronized void setSubject(String subject)
Sets the subject of this annotation.
void setSubtext(String subtext)
Sets text displayed in a second smaller line of the stamp.
void updateTransformationProperties(RectF newBoundingBox, RectF oldBoundingBox)
Annotations may override this method to transform their properties (i.e.
[Expand]
Inherited Methods
From class com.pspdfkit.annotations.Annotation
From class java.lang.Object

Public Constructors

public StampAnnotation (int pageIndex, RectF rect, byte[] compressedBitmap)

Creates a new stamp annotation with the passed bitmap as contents.

Parameters
pageIndex Page to which this annotation will be attached to.
rect Bounding rectangle for this annotations image.
compressedBitmap JPEG compressed bitmap data to be stored into the annotation.

public StampAnnotation (int pageIndex, RectF rect, Bitmap bitmap)

Creates a new stamp annotation with the passed bitmap as contents.

Parameters
pageIndex Page to which this annotation will be attached to.
rect Bounding rectangle for this annotations image.
bitmap Bitmap to be stored into the annotation.

public StampAnnotation (int pageIndex, RectF rect, StampAnnotation.StampType stampType)

Creates a new standard stamp annotation.

Parameters
pageIndex Page to which this annotation will be attached to.
rect Bounding rectangle for this annotations image.
stampType Stamp type to display.

public StampAnnotation (int pageIndex, RectF rect, String subject)

Creates a new stamp with custom subject.

Parameters
pageIndex Page to which this annotation will be attached to.
rect Bounding rectangle for this annotations image.
subject Subject describing this stamp contents.

Public Methods

public void adjustBoundsForRotation ()

This adjusts the annotations bounding box to the smallest possible size that will encompass the rotated annotations at it's default size.

public synchronized Bitmap getBitmap ()

Returns a bitmap from this stamp annotation if there is any.

public String getLocalizedSubject ()

Localized subject is the customized text replacing the default subject text from a StampAnnotation.StampType.

Returns
  • currently set localized subject or null if nothing.

public Size getMinimumSize ()

Returns the minimum size of the annotation.

Returns
  • The minimum annotation size in PDF points.

public int getRotation ()

Returns the clockwise rotation of this stamp in degrees.

Returns
  • The clockwise rotation of this stamp in degrees.

public StampAnnotation.StampType getStampType ()

Returns type of this stamp if it's one of the standard types listed in StampAnnotation.StampType. Returns null if the stamp uses a non-standard subject.

Returns
  • stamp type or null if the type isn't standard.

public String getSubtext ()

Returns text in second line of the stamp if any is available.

Returns
  • subtext of the annotation or null if none is set.

public AnnotationType getType ()

Gets the annotation type of the annotation.

Returns
  • The type of the annotation. Makes down casting easier.

public boolean hasBitmap ()

Checks whether annotation is an annotationBitmap annotation.

public synchronized void setBitmap (Bitmap bitmap)

Sets a custom bitmap for this stamp annotation.

Note: This clears existing subject, localized subject and subtext.

Parameters
bitmap Bitmap to be stored into the annotation.

public synchronized void setBitmap (byte[] compressedBitmap)

Sets a custom bitmap for this stamp annotation.

Note: This clears existing subject, localized subject and subtext.

Parameters
compressedBitmap JPEG compressed bitmap data to be stored into the annotation.

public void setLocalizedSubject (String localizedSubject)

Sets localized text to be displayed instead of default subject of a StampAnnotation.StampType.

Parameters
localizedSubject localized subject to set, null to revert to default.

public void setRotation (int rotation, boolean adjustBounds)

Sets the rotation of this stamp. See also adjustBoundsForRotation()

Parameters
rotation The clockwise rotation in degrees.
adjustBounds If true will also adjust the bounding box to match the new rotation.

public void setRotation (int rotation, Size contentSize)

Sets the rotation of this stamp. This will adjust the bounding box so rotating the annotation will cause the bounds to change. See also setRotation(int). See also setRotation(int, Size, boolean).

Parameters
rotation The clockwise rotation in degrees.
contentSize The size of the annotation content, it will be rotated and scaled to fit inside the actual bounding box.

public void setRotation (int rotation, Size contentSize, boolean adjustBounds)

Sets the rotation of this stamp. See also adjustBoundsForRotation().

Parameters
rotation The clockwise rotation in degrees.
contentSize The size of the annotation content, it will be rotated and scaled to fit inside the actual bounding box.
adjustBounds If true will also adjust the bounding box to match the new rotation.

public void setRotation (int rotation)

Sets the rotation of this stamp. This will adjust the bounding box so rotating the annotation will cause the bounds to change. See also setRotation(int, Size). See also setRotation(int, boolean).

Parameters
rotation The clockwise rotation in degrees.

public synchronized void setSubject (String subject)

Sets the subject of this annotation.

Parameters
subject The subject of this annotation or null to clear the field.

public void setSubtext (String subtext)

Sets text displayed in a second smaller line of the stamp.

Parameters
subtext text to be displayed or null if none should be shown.

public void updateTransformationProperties (RectF newBoundingBox, RectF oldBoundingBox)

Annotations may override this method to transform their properties (i.e. points, rects, sizes) whenever the bounding box of the annotation changed.

Parameters
newBoundingBox New bounding box of the annotation (in PDF points).
oldBoundingBox Old bounding box of the annotation (in PDF points).