public class

InkAnnotation

extends Annotation
implements ResizableAnnotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.InkAnnotation

Class Overview

Represents a freehand drawing on the page.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Constructors
InkAnnotation(int pageIndex)
Creates a new ink annotation.
Public Methods
float getLineWidth()
Gets ink line width/thickness.
List<List<PointF>> getLines()
Returns list of lines of this Ink annotation represents.
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 setIsSignature(boolean isSignature)
Sets whether this annotation is an electronic signature annotation.
void setLineWidth(float lineWidth)
Sets ink line width/thickness.
void setLines(List<List<PointF>> lines)
Sets and overwrites existing list of lines for this ink annotation.
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 InkAnnotation (int pageIndex)

Creates a new ink annotation.

Parameters
pageIndex Page to which this annotation will be attached to.

Public Methods

public float getLineWidth ()

Gets ink line width/thickness.

Returns
  • Line width in PDF points.

public 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(List) before the changes are properly applied to the document.

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

public AnnotationType getType ()

Gets the annotation type of the annotation.

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

public 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).

public 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. By default this is false.

public void setLineWidth (float lineWidth)

Sets ink line width/thickness.

Parameters
lineWidth Line width of the ink in PDF points.

public void setLines (List<List<PointF>> lines)

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

Parameters
lines List of lines this ink annotation represents.

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