public class

LineAnnotation

extends BaseLineAnnotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.ShapeAnnotation
       ↳ com.pspdfkit.annotations.BaseLineAnnotation
         ↳ com.pspdfkit.annotations.LineAnnotation

Class Overview

Represents a line on the page.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Constructors
LineAnnotation(int pageIndex, PointF point1, PointF point2)
Creates a new line annotation.
LineAnnotation(int pageIndex, PointF point1, PointF point2, Scale scale, MeasurementPrecision precision)
Creates a measurement distance annotation.
Public Methods
Pair<LineEndTypeLineEndType> getLineEnds()
Returns current line ending styles for this line.
Pair<PointFPointF> getPoints()
Returns starting and ending point of this line in PDF coordinates.
AnnotationType getType()
Gets the annotation type of the annotation.
void setLineEnds(LineEndType lineEnd1, LineEndType lineEnd2)
Sets line ending style for this line.
void setPoints(PointF point1, PointF point2)
Sets a starting and ending point of the line in PDF coordinates.
[Expand]
Inherited Methods
From class com.pspdfkit.annotations.BaseLineAnnotation
From class com.pspdfkit.annotations.ShapeAnnotation
From class com.pspdfkit.annotations.Annotation
From class java.lang.Object

Public Constructors

public LineAnnotation (int pageIndex, PointF point1, PointF point2)

Creates a new line annotation.

Parameters
pageIndex Page to which this annotation will be attached to.
point1 Starting point of the line in PDF coordinates.
point2 End point of the line in PDF coordinates.

public LineAnnotation (int pageIndex, PointF point1, PointF point2, Scale scale, MeasurementPrecision precision)

Creates a measurement distance annotation. Will throw an exception if Measurement Tools are not licensed.

Parameters
pageIndex Page to which this annotation will be attached to.
point1 Starting point of the line in PDF coordinates.
point2 End point of the line in PDF coordinates.
scale Measurement Scale for the annotation.
precision Measurement MeasurementPrecision for the annotation.

Public Methods

public Pair<LineEndTypeLineEndType> getLineEnds ()

Returns current line ending styles for this line.

Returns
  • Pair of start and end line ending styles. If they're not set, returns NONE.

public Pair<PointFPointF> getPoints ()

Returns starting and ending point of this line in PDF coordinates.

Returns
  • Pair of start and end point. If for any reason valid coordinates aren't set, returns (0, 0) points.

public AnnotationType getType ()

Gets the annotation type of the annotation.

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

public void setLineEnds (LineEndType lineEnd1, LineEndType lineEnd2)

Sets line ending style for this line.

Parameters
lineEnd1 LineEndType for start of this line.
lineEnd2 LineEndType for end of this line.

public void setPoints (PointF point1, PointF point2)

Sets a starting and ending point of the line in PDF coordinates.

Parameters
point1 Starting point of the line in PDF coordinates.
point2 End point of the line in PDF coordinates.