Class StampAnnotation

  • All Implemented Interfaces:

    
    public class StampAnnotation
    extends Annotation
                        

    Represents a stamp or annotationBitmap annotation on the page.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      StampAnnotation(int pageIndex, RectF rect, Array<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.
      StampAnnotation(AnnotationPropertyMap properties, boolean markDirty, String imageResourceId) Intended for internal usage only
      StampAnnotation(AnnotationPropertyMap properties, boolean markDirty, Bitmap bitmap) Intended for internal usage only
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      AnnotationType getType() Gets the annotation type of the annotation.
      void updateTransformationProperties(@NonNull() RectF newBoundingBox, @NonNull() RectF oldBoundingBox) Annotations may override this method to transform their properties (i.e.
      String getTitle() Returns text in first line of the stamp if any is available.
      void setTitle(@Nullable() String title) Sets text displayed in the first line of the stamp.
      String getSubtitle() Returns text in second line of the stamp if any is available.
      void setSubtitle(@Nullable() String subtitle) Sets text displayed in a second smaller line of the stamp.
      StampType getStampType() Returns type of this stamp if it's one of the standard types listed in StampType.
      synchronized void setStampType(@Nullable() StampType stampType) Sets the type of stamp this is.
      synchronized Bitmap getBitmap() Returns a bitmap from this stamp annotation if there is any.
      synchronized boolean hasBitmap() Checks whether annotation is an annotationBitmap annotation.
      synchronized void setBitmap(@NonNull() Bitmap bitmap) Sets a custom bitmap for this stamp annotation.
      synchronized void setBitmap(@NonNull() Array<byte> compressedBitmap) Sets a custom bitmap for this stamp annotation.
      int getRotation() Returns the clockwise rotation of this stamp in degrees.
      void setRotation(int rotation, @NonNull() Size contentSize) Sets the rotation of this stamp.
      void setRotation(int rotation, @NonNull() Size contentSize, boolean adjustBounds) Sets the rotation of this stamp.
      void setRotation(int rotation) Sets the rotation of this stamp.
      void setRotation(int rotation, boolean adjustBounds) Sets the rotation of this stamp.
      void adjustBoundsForRotation() This adjusts the annotations bounding box to the smallest possible size that will encompass the rotated annotations at it's default size.
      Size getMinimumSize() Returns the minimum size of the annotation.
      String toInstantJson() Produces Instant JSON representation of this annotation.
      void setIsSignature(boolean isSignature) Sets whether this annotation is an electronic signature annotation.
      boolean isUiRotationSupported() Returns true if this Annotation can be rotated in the UI.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StampAnnotation

        StampAnnotation(int pageIndex, RectF rect, Array<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.
      • StampAnnotation

        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.
      • StampAnnotation

        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.
      • StampAnnotation

        StampAnnotation(int pageIndex, RectF rect, String title)
        Creates a new stamp with custom title.
        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.
      • StampAnnotation

        StampAnnotation(AnnotationPropertyMap properties, boolean markDirty, String imageResourceId)
        Intended for internal usage only
      • StampAnnotation

        StampAnnotation(AnnotationPropertyMap properties, boolean markDirty, Bitmap bitmap)
        Intended for internal usage only
    • Method Detail

      • updateTransformationProperties

         void updateTransformationProperties(@NonNull() RectF newBoundingBox, @NonNull() 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).
      • setTitle

         void setTitle(@Nullable() 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.
      • setSubtitle

         void setSubtitle(@Nullable() 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.
      • setStampType

         synchronized void setStampType(@Nullable() StampType stampType)

        Sets the type of stamp this is.

        Parameters:
        stampType - Stamp type to set.
      • getBitmap

        @Nullable() synchronized Bitmap getBitmap()

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

      • hasBitmap

         synchronized boolean hasBitmap()

        Checks whether annotation is an annotationBitmap annotation.

      • setBitmap

         synchronized void setBitmap(@NonNull() 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.
      • setBitmap

         synchronized void setBitmap(@NonNull() Array<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.
      • getRotation

         int getRotation()

        Returns the clockwise rotation of this stamp in degrees.

      • setRotation

         void setRotation(int rotation, @NonNull() Size contentSize)

        Sets the rotation of this stamp. This will adjust the bounding box so rotating the annotation will cause the bounds to change.

        Hint: If you are using a custom AP stream make sure that the bounding box aspect ratio matches the source aspect ratio exactly, otherwise the stamp will appear distorted when rotated.

        See also setRotation. See also setRotation.

        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.
      • setRotation

         void setRotation(int rotation, @NonNull() Size contentSize, boolean adjustBounds)

        Sets the rotation of this stamp.

        Hint: If you are using a custom AP stream make sure that the bounding box aspect ratio matches the source aspect ratio exactly, otherwise the stamp will appear distorted when rotated.

        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.
      • setRotation

         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.

        Hint: If you are using a custom AP stream make sure that the bounding box aspect ratio matches the source aspect ratio exactly, otherwise the stamp will appear distorted when rotated.

        See also setRotation. See also setRotation.

        Parameters:
        rotation - The clockwise rotation in degrees.
      • setRotation

         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.
      • adjustBoundsForRotation

         void adjustBoundsForRotation()

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

      • toInstantJson

        @NonNull() String toInstantJson()

        Produces Instant JSON representation of this annotation.

        Note: Make sure the annotation is attached to the document before exporting it to Instant JSON.

      • setIsSignature

         void setIsSignature(boolean isSignature)

        Sets whether this annotation is an electronic signature annotation.

        Parameters:
        isSignature - Whether or not this annotation is classed as an electronic signature.
      • isUiRotationSupported

         boolean isUiRotationSupported()

        Returns true if this Annotation can be rotated in the UI.