The STSignatureCapture class is the most important component of the libSignoSignatureCapture library. This class can be used to display a dialog to capture a signature. The class is part of libSignoPDFSigner as well as of libSignoSignatureCapture.
Usage:
STSignatureCapture signatureCapture = STSignatureCaptureCreator.createSignatureCapture(context);
setSignatureCaptureNotifier method
This method can be used to set the instance of a class that implements the STSignatureCaptureNotifier interface and is therefore to be informed of events in the STSignatureCapture.
void setSignatureCaptureNotifier(STSignatureCaptureNotifier signatureCaptureNotifier);
|
Parameter |
Description |
|
STSignatureCaptureNotifier signatureCaptureNotifier |
STSignatureCaptureNotifier instance |
|
Return value |
Description |
|
- |
- |
Usage:
STSignatureCaptureNotifier signatureCaptureNotifier = new STSignatureCaptureNotifierImpl();
signatureCapture.setSignatureCaptureNotifier(signatureCaptureNotifier);
configureDialog method
This method can be used to position and configure the signature dialog. The configuration is ignored if the enableFullScreenCapture property of the STSignatureCaptureConfig class is set to true.
void configureDialog(Rect dialogFrame, STSignatureCaptureConfig captureConfig);
|
Parameter |
Description |
|
Rect dialogFrame |
Position specification of the signature dialog. |
|
STSignatureCaptureConfig captureConfig |
The STSignatureCaptureConfig object or null. |
|
Return value |
Description |
|
- |
- |
Usage:
STSignatureCaptureConfig captureConfig = new STSignatureCaptureConfig();
captureConfig.setSignatureColor(Color.BLUE);
captureConfig.setLineWidth(4);
captureConfig.setEnableFullScreenCapture(false);
captureConfig.setEnableBiometricDataCapturing(true);
captureConfig.setEnablePressureDependentCapturing(false);
captureConfig.setEnableTouchSignature(true);
captureConfig.setEnablePencilSignature(true);
captureConfig.setCaptureTextConfig(new STCaptureTextConfig.Builder()
.displayText("Your signature")
.font(Typeface.create("Arial", Typeface.BOLD))
.textColor(Color.BLACK)
.fontSize(20)
.backgroundColor(Color.YELLOW)
.gravity(STCaptureTextConfig.CaptureGravity.TOP_START)
.marginTop(20)
.marginStart(20)
.paddingStart(10)
.paddingEnd(10)
.paddingTop(10)
.paddingBottom(10)
.build());
signatureCapture.configureDialog(rect, captureConfig);
getSignatureImage method
This method returns the most recently captured signature as an image in PNG format.
byte[] getSignautureImage(float width, float height, int penColor, int penWidth) throws STSignatureCaptureException;
|
Parameter |
Description |
|
float width |
Maximum width of the image in pixels. |
|
float height |
Maximum height of the image in pixels. |
|
int penColor |
Colour of the signature line. |
|
int penWidth |
Width of the signature line in pixels. |
|
Return value |
Description |
|
byte[] |
The signature image as a byte array or null. |
|
Exception |
Description |
|
STSignatureCaptureException |
Is thrown if an error occurs when the signature image is generated. |
Usage:
try {
byte[] signatureImage =
signatureCapture.getSignatureImage(1500, 1000, Color.BLUE, 10);
} catch (STSignatureCaptureException e) {
//error handling
}
getSignData method
This method returns the most recently captured signature in SignData format.
byte[] getSignData();
|
Parameter |
Description |
|
- |
- |
|
Return value |
Description |
|
byte[] |
The SignData as a byte array or null. |
Usage:
byte[] signData = signatureCapture.getSignData();
setLicenseKey method
This method can be used to enable the libSignoSignatureCapture component and, in so doing, to remove the demo message. Please use the licence string that was given to you by your contact at signotec.
Please note: This method can only be used for licence keys in the old format. If you have a licence key in the new UUID format (XXXXXXXX–XXXX–XXXX–XXXX–XXXXXXXXXXXX), please use the STLicenceManager class.
void setLicenseKey(String licenseKey);
|
Parameter |
Description |
|
|
String licenseKey |
Licence string |
|
|
Return value |
Description |
|
|
- |
- |
|
Usage:
signatureCapture.setLicenseKey("1234");
startSignatureCapture method
This method can be used to start the signature capture process.
void startSignatureCapture() throws STSignatureCaptureException;
|
Parameter |
Description |
|
|
- |
- |
|
|
Return value |
Description |
|
|
- |
- |
|
|
Exception |
Description |
|
|
STSignatureCaptureException |
Is thrown if the activity class whose context is transferred when the STSignatureCaptureCreator.createSignatureCapture() method is called is not in the foreground or has been ended. |
|
Usage:
try {
signatureCapture.startSignatureCapture();
} catch {
//error handling
}
resizeCaptureDialog method
This method can change the size and position of the signature dialog in accordance with the new configuration of the signature dialog resulting from the configureDialog() method when the device is rotated and is generally called in the onConfigurationChanged() method of the corresponding activity class.
void resizeCaptureDialog();
|
Parameter |
Description |
|
|
- |
- |
|
|
Return value |
Description |
|
|
- |
- |
|
Usage:
signatureCapture.resizeCaptureDialog();