Class Signature
-
- All Implemented Interfaces:
-
android.os.Parcelable
public final class Signature implements Parcelable
Represents a single signature (or signature item). To create an Annotation from this signature use the toAnnotation methods. Helper methods to create Ink or Stamp Signatures are here: createStampSignature, createInkSignature.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
Signature.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static Long
ID_NOT_SET
private final RectF
boundingBox
private final Long
id
private final Integer
inkColor
private final Float
lineWidth
private final List<List<PointF>>
lines
private final BiometricSignatureData
biometricData
private final Float
drawWidthRatio
private final Bitmap
bitmap
private final RectF
stampRect
public final static Signature.Companion
Companion
-
Method Summary
Modifier and Type Method Description final RectF
getBoundingBox()
Returns bounding box of the signature data in pdf coordinates. final Long
getId()
Signature id number used in signature database. final Integer
getInkColor()
Colour of the ink signature final Float
getLineWidth()
Signature line width in pdf points. final List<List<PointF>>
getLines()
List of ink lines in pdf points. final BiometricSignatureData
getBiometricData()
BiometricSignatureData that was collected with this signature. final Float
getDrawWidthRatio()
The ratio of signature width to width of the drawing view used when drawing the signature. final Bitmap
getBitmap()
When creating a stamp signature (as opposed to ink signature), you need to provide a bitmap. final RectF
getStampRect()
Bounding rectangle for this signature's bitmap. final JSONObject
toJson()
Converts a signature into a JSON object. final Annotation
toAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, PointF touchPoint)
Builds InkAnnotation or StampAnnotation from signature data. final Annotation
toAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, RectF targetRect)
Builds InkAnnotation or StampAnnotation from signature data. final Annotation
toAnnotation(@IntRange(from = 0) Integer pageIndex)
Builds InkAnnotation or StampAnnotation from signature data. -
-
Method Detail
-
getBoundingBox
final RectF getBoundingBox()
Returns bounding box of the signature data in pdf coordinates. The bounding box will always have its
left
andbottom
values equal0
.- Returns:
Rect enclosing all lines of this signature. Always starts at (0,0) (bottom left corner).
-
getId
final Long getId()
Signature id number used in signature database. If not set, the default value is ID_NOT_SET.
-
getInkColor
@ColorInt() final Integer getInkColor()
Colour of the ink signature
-
getLineWidth
final Float getLineWidth()
Signature line width in pdf points.
-
getBiometricData
final BiometricSignatureData getBiometricData()
BiometricSignatureData that was collected with this signature. May return
null
if no biometric data was created.
-
getDrawWidthRatio
final Float getDrawWidthRatio()
The ratio of signature width to width of the drawing view used when drawing the signature.
This size is used in toAnnotation to auto-size annotation around touched point so that the largest signatures cover 1/4 of the page and smaller less.
-
getBitmap
final Bitmap getBitmap()
When creating a stamp signature (as opposed to ink signature), you need to provide a bitmap.
-
getStampRect
final RectF getStampRect()
Bounding rectangle for this signature's bitmap.
-
toJson
final JSONObject toJson()
Converts a signature into a JSON object. You can use that JSON object to recreate the signature later on via fromJson.
- Returns:
A JSON object representing a converted signature.
-
toAnnotation
final Annotation toAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, PointF touchPoint)
Builds InkAnnotation or StampAnnotation from signature data.
- Parameters:
document
- Target document where the annotation will be added to.pageIndex
- Target page index indocument
where the annotation will be added to.touchPoint
- Point where the annotation should be created.- Returns:
InkAnnotation or StampAnnotation representing this signature.
-
toAnnotation
final Annotation toAnnotation(PdfDocument document, @IntRange(from = 0) Integer pageIndex, RectF targetRect)
Builds InkAnnotation or StampAnnotation from signature data.
- Parameters:
document
- Target document where the annotation will be added to.pageIndex
- Target page index indocument
where the annotation will be added to.targetRect
- Rect on the page into which the annotation should be fitted.- Returns:
InkAnnotation or StampAnnotation representing this signature.
-
toAnnotation
final Annotation toAnnotation(@IntRange(from = 0) Integer pageIndex)
Builds InkAnnotation or StampAnnotation from signature data. If you want to create a stamp annotation with a specific bounding box around certain touch point, use toAnnotation instead.
- Parameters:
pageIndex
- Target page index where the annotation will be added to.- Returns:
Stamp annotation representing this signature, or null if class is not an image signature.
-
-
-
-