java.lang.Object | |
↳ | com.pspdfkit.signatures.Signature |
Represents a single signature (or signature item). To create an InkAnnotation
or StampAnnotation
from this signature use the toInkAnnotation(int)
and toStampAnnotation(int)
methods. You can check the signature annotation type through getAnnotationType()
. 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()
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | BITMAP_NOT_SET | Indicates that the bitmap has not been set. | |||||||||
long | ID_NOT_SET | Indicates that the id has not been set. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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 AnnotationType |
getAnnotationType()
Gets the annotation type of the signature, which can either be
InkAnnotation or
StampAnnotation . | ||||||||||
abstract BiometricSignatureData |
getBiometricData()
Gets the biometric data that was collected with this signature.
| ||||||||||
Bitmap |
getBitmap()
Gets the bitmap used for rendering the image signature, or
null if the signature is
not an image signature. | ||||||||||
abstract int |
getBitmapIdentifier()
Gets the bitmap identifier used for rendering the image signature, or
BITMAP_NOT_SET
if the signature is not represented by a bitmap. | ||||||||||
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 . | ||||||||||
abstract RectF |
getStampRect()
Bounding rectangle for this signature's bitmap.
| ||||||||||
static Bitmap |
textToBitmap(String text, Font font, int color, float scaleFactor, DisplayMetrics displayMetrics)
Creates a bitmap from text that the user typed and a font the user chose.
| ||||||||||
InkAnnotation |
toInkAnnotation(PdfDocument document, int pageIndex, RectF targetRect)
Builds ink annotation from signature data.
| ||||||||||
InkAnnotation |
toInkAnnotation(int pageIndex)
Builds ink annotation from signature data.
| ||||||||||
InkAnnotation |
toInkAnnotation(PdfDocument document, int pageIndex, PointF touchPoint)
Builds ink annotation from signature data.
| ||||||||||
JSONObject |
toJson()
Converts a signature into a JSON object.
| ||||||||||
StampAnnotation |
toStampAnnotation(PdfDocument document, int pageIndex, RectF targetRect)
Builds stamp annotation from signature data.
| ||||||||||
StampAnnotation |
toStampAnnotation(PdfDocument document, int pageIndex, PointF touchPoint)
Builds stamp annotation from signature data.
| ||||||||||
StampAnnotation |
toStampAnnotation(int pageIndex)
Builds stamp annotation from signature data.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Indicates that the bitmap has not been set.
Indicates that the id has not been set.
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.
id | Id to be assigned to the signature. |
---|---|
signatureJson | JSON object to parse. |
JSONException |
---|
Creates a signature object by parsing the provided JSON object. The JSON object you provide
should be initially obtained via toJson()
.
signatureJson | JSON object to parse. |
---|
JSONException |
---|
Gets the annotation type of the signature, which can either be InkAnnotation
or
StampAnnotation
. Useful for getting the correct type through toInkAnnotation(int)
and toStampAnnotation(PdfDocument, int, PointF)
.
AnnotationType
of the signature. This can either be INK
or STAMP
.
Gets the biometric data that was collected with this signature. May return null
if no
biometric data was created.
BiometricSignatureData
that was collected with this signature, or null
if no biometric data was collected.
Gets the bitmap used for rendering the image signature, or null
if the signature is
not an image signature.
NOTE: The returned bitmap is kept in memory in a hash map but this method is meant to be used as an auxiliary method for adding the signature to the document. The bitmap may be destroyed when the app is in background and the system kills the process because needs to release memory resources. This method does not guarantee persistence, to implement this kind of use case it's better to rely on a database, or a cache mechanism that stores the bitmap in the local storage.
null
if the signature is
not an image signature.
Gets the bitmap identifier used for rendering the image signature, or BITMAP_NOT_SET
if the signature is not represented by a bitmap.
Returns bounding box of the signature data in pdf coordinates. The bounding box will always
have its left
and bottom
values equal 0
.
Signature id number used in signature database. If not set, the default value is ID_NOT_SET
.
Gets color used for signature ink.
Gets signature line width.
Access list of signature lines.
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()
.
Signer
, or null
if no signer is associated
with this signature.
Bounding rectangle for this signature's bitmap.
Creates a bitmap from text that the user typed and a font the user chose.
text | The text to be displayed. |
---|---|
font | The font to use to show the text. |
color | The color to render the text. |
scaleFactor | A factor, always positive, by which to scale the bitmap size. |
displayMetrics | DisplayMetrics instance. |
Builds ink annotation from signature data.
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. |
Builds ink annotation from signature data. This method does not set annotation's bounding
box. If you want to create a stamp annotation with bounding box around certain touch point,
use toInkAnnotation(PdfDocument, int, PointF)
instead.
pageIndex | Target page index where the annotation will be added to. |
---|
Builds ink annotation from signature data.
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. |
Converts a signature into a JSON object. You can use that JSON object to recreate the
signature later on via fromJson(JSONObject)
.
JSONException |
---|
Builds stamp annotation from signature data.
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. |
Builds stamp annotation from signature data.
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. |
Builds stamp annotation from signature data. If you want to create a stamp annotation with a
specific bounding box around certain touch point, use toStampAnnotation(PdfDocument, int, PointF)
instead.
pageIndex | Target page index where the annotation will be added to. |
---|