public abstract class

Signature

extends Object
implements Parcelable
java.lang.Object
   ↳ com.pspdfkit.signatures.Signature

Class Overview

Represents a single signature (or signature item). To create an InkAnnotation from this signature use toInkAnnotation(PdfDocument, int, PointF). Additionally, the signature can be associated with a Signer for digitally signing a PDF. You can retrieve the getSignerIdentifier() which can be used to retrieve the signer instance using getSigners().

Summary

Constants
long ID_NOT_SET Indicates that the id has not been set.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Public Constructors
Signature()
Public Methods
static Signature fromJson(long id, JSONObject signatureJson)
Creates a signature object by parsing the provided JSON object.
static Signature fromJson(JSONObject signatureJson)
Creates a signature object by parsing the provided JSON object.
abstract BiometricSignatureData getBiometricData()
Gets the biometric data that was collected with this signature.
RectF getBoundingBox()
Returns bounding box of the signature data in pdf coordinates.
abstract long getId()
Signature id number used in signature database.
abstract int getInkColor()
Gets color used for signature ink.
abstract float getLineWidth()
Gets signature line width.
abstract List<List<PointF>> getLines()
Access list of signature lines.
abstract String getSignerIdentifier()
Gets the unique identifier of an associated Signer.
InkAnnotation toInkAnnotation(PdfDocument document, int pageIndex, RectF targetRect)
Builds signature annotation from signature data.
InkAnnotation toInkAnnotation(int pageIndex)
Builds ink annotation from signature data.
InkAnnotation toInkAnnotation(PdfDocument document, int pageIndex, PointF touchPoint)
Builds signature annotation from signature data.
JSONObject toJson()
Converts a signature into a JSON object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final long ID_NOT_SET

Indicates that the id has not been set.

Constant Value: -1 (0xffffffffffffffff)

Public Constructors

public Signature ()

Public Methods

public static Signature fromJson (long id, JSONObject signatureJson)

Creates a signature object by parsing the provided JSON object. The JSON object you provide should be initially obtained via toJson(). This method also allows you to specify an id which will be assigned to the signature created from the given JSON. This id will also be assigned by the framework when retrieving the signatures from the default storage.

Parameters
id Id to be assigned to the signature.
signatureJson JSON object to parse.
Returns
  • Signature created from the provided JSON object.
Throws
JSONException
See Also

public static Signature fromJson (JSONObject signatureJson)

Creates a signature object by parsing the provided JSON object. The JSON object you provide should be initially obtained via toJson().

Parameters
signatureJson JSON object to parse.
Returns
  • Signature created from the provided JSON object.
Throws
JSONException
See Also

public abstract BiometricSignatureData getBiometricData ()

Gets the biometric data that was collected with this signature. May return null if no biometric data was created.

Returns
  • The BiometricSignatureData that was collected with this signature, or null if no biometric data was collected.

public RectF getBoundingBox ()

Returns bounding box of the signature data in pdf coordinates. The bounding box will always have its left and bottom values equal 0.

Returns
  • Rect enclosing all lines of this signature. Always starts at (0,0) (bottom left corner).

public abstract long getId ()

Signature id number used in signature database. If not set, the default value is ID_NOT_SET.

Returns
  • Id number assigned from the database.

public abstract int getInkColor ()

Gets color used for signature ink.

Returns
  • Color of the signature ink.

public abstract float getLineWidth ()

Gets signature line width.

Returns
  • Width of signature ink lines in pdf points.

public abstract List<List<PointF>> getLines ()

Access list of signature lines.

Returns
  • List of lines consisting from pdf points.

public abstract String getSignerIdentifier ()

Gets the unique identifier of an associated Signer. When a non-null identifier is returned it will be used to retrieve a signer from getSigners().

Returns
  • The unique identifier of a Signer, or null if no signer is associated with this signature.

public InkAnnotation toInkAnnotation (PdfDocument document, int pageIndex, RectF targetRect)

Builds signature annotation from signature data.

Parameters
document Target document where the annotation will be added to.
pageIndex Target page index in document where the annotation will be added to.
targetRect Rect on the page into which the annotation should be fitted.

public InkAnnotation toInkAnnotation (int pageIndex)

Builds ink annotation from signature data. This method does not set annotation's bounding box. If you want to create ink annotation with bounding box around certain touch point, use toInkAnnotation(PdfDocument, int, PointF) instead.

Parameters
pageIndex Target page index where the annotation will be added to.
Returns
  • Ink annotation representing this signature.

public InkAnnotation toInkAnnotation (PdfDocument document, int pageIndex, PointF touchPoint)

Builds signature annotation from signature data.

Parameters
document Target document where the annotation will be added to.
pageIndex Target page index in document where the annotation will be added to.
touchPoint Point where the annotation should be created.

public JSONObject toJson ()

Converts a signature into a JSON object. You can use that JSON object to recreate the signature later on via fromJson(JSONObject).

Returns
  • A JSON object representing a converted signature.
Throws
JSONException