Class InkAnnotation

  • All Implemented Interfaces:

    
    public class InkAnnotation
    extends Annotation
                        

    Represents a freehand drawing 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
      InkAnnotation(int pageIndex) Creates a new ink annotation.
      InkAnnotation(AnnotationPropertyManager properties, boolean markDirty) 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.
      boolean isResizable() Check if the annotation is resizable, or if this is a non-resizable annotation.
      void updateTransformationProperties(@NonNull() RectF newBoundingBox, @NonNull() RectF oldBoundingBox) Annotations may override this method to transform their properties (i.e.
      List<List<PointF>> getLines() Returns list of lines of this Ink annotation represents.
      void setLines(@NonNull() List<List<PointF>> lines) Sets and overwrites existing list of lines for this ink annotation.
      float getLineWidth() Gets ink line width/thickness.
      void setLineWidth(@FloatRange(from = 0.0) float lineWidth) Sets ink line width/thickness.
      void setIsSignature(boolean isSignature) Sets whether this annotation is an electronic signature annotation.
      • Methods inherited from class java.lang.Object

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

      • InkAnnotation

        InkAnnotation(int pageIndex)
        Creates a new ink annotation.
        Parameters:
        pageIndex - Page to which this annotation will be attached to.
      • InkAnnotation

        InkAnnotation(AnnotationPropertyManager properties, boolean markDirty)
        Intended for internal usage only.
    • Method Detail

      • getType

        @NonNull() AnnotationType getType()

        Gets the annotation type of the annotation.

        Returns:

        The type of the annotation. Makes down casting easier.

      • isResizable

         boolean isResizable()

        Check if the annotation is resizable, or if this is a non-resizable annotation.

        Returns:

        true if the annotation can be resized (e.g. ink annotation) or false if it is a non-resizable one (e.g. note annotation).

      • 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).
      • getLines

        @NonNull() List<List<PointF>> getLines()

        Returns list of lines of this Ink annotation represents. A line is a list of connected points in PDF coordinates. An ink annotation may have several such disjoint lines of the same color.

        Note: if you modify returned collection you must call setLines before the changes are properly applied to the document.

        Returns:

        List of drawn lines represented as list of points in PDF coordinates.

      • setLines

         void setLines(@NonNull() List<List<PointF>> lines)

        Sets and overwrites existing list of lines for this ink annotation.

        Parameters:
        lines - List of lines this ink annotation represents.
      • getLineWidth

         float getLineWidth()

        Gets ink line width/thickness.

        Returns:

        Line width in PDF points.

      • setLineWidth

         void setLineWidth(@FloatRange(from = 0.0) float lineWidth)

        Sets ink line width/thickness.

        Parameters:
        lineWidth - Line width of the ink in PDF points.
      • 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.