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

[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, StampType stampType)
Creates a new standard stamp annotation.
StampAnnotation(int pageIndex, RectF rect, String title)
Creates a new stamp with custom title.
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.
Size getMinimumSize()
Returns the minimum size of the annotation.
int getRotation()
Returns the clockwise rotation of this stamp in degrees.
StampType getStampType()
Returns type of this stamp if it's one of the standard types listed in StampType.
String getSubtitle()
Returns text in second line of the stamp if any is available.
String getTitle()
Returns text in first line of the stamp if any is available.
AnnotationType getType()
Gets the annotation type of the annotation.
synchronized 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 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 setStampType(StampType stampType)
Sets the type of stamp this is.
void setSubtitle(String subtitle)
Sets text displayed in a second smaller line of the stamp.
void setTitle(String title)
Sets text displayed in the first 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, 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 title)

Creates a new stamp with custom title. Note: Starting with PSPDFKit 5.0 the subject will no longer influence the appearance of the stamp annotation. The title is used instead. To create a standard stamp use StampAnnotation(int, RectF, StampType).

Parameters
pageIndex Page to which this annotation will be attached to.
rect Bounding rectangle for this annotations image.
title Title to display on the stamp.

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 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 StampType getStampType ()

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

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

public String getSubtitle ()

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

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

public String getTitle ()

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

Returns
  • title 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 synchronized 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 stamp type, title and subtitle.

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 stamp type, title and subtitle.

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

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 setStampType (StampType stampType)

Sets the type of stamp this is.

Parameters
stampType Stamp type to set.

public void setSubtitle (String subtitle)

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

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

public void setTitle (String title)

Sets text displayed in the first line of the stamp.

Parameters
title text to be displayed or null if the default 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).