SigObj
SigObj
This class provides properties and methods for the signature.
Full qualification: com.florentis.signature.SigObj
Summary
| Method | |
|---|---|
| clear | |
| checkIntegrity | |
| checkSignedData | |
| renderBitmap | |
| renderRect | |
| readEncodedBitmap | |
| close | |
| Property | |
|---|---|
| additionalData | |
| crossedOut | |
| extraData | |
| height | |
| ink | |
| isCaptured | |
| sigData | |
| sigText | |
| who | |
| why | |
| when | |
| width | |
Methods
checkIntegrity
Checks the integrity of the Signature object to detect whether it has been tampered with since signing.
| public native int checkIntegrity(Key key) | |
|---|---|
| Parameters | |
| key | Optional Key object. If not supplied, MD5 is used by default. |
| Return Value | |
| checkIntegrityResult | |
| 0 | integrityOK – Data has not changed since signature capture. |
| 1 | integrityFail – Data has changed since signature capture. |
| 2 | integrityMissing – Signature integrity value not found. |
| 3 | integrityWrongType – Signature was captured using a different integrity check version. |
checkSignedData
Checks for a match between a given hash and that provided when the signature was captured.
| public native int checkSignedData(Hash hash) | |
|---|---|
| Parameters | |
| hash | Required Hash object to be compared with the one provided when the signature was captured |
| Return Value | |
| checkIntegrityResult | |
| 0 | integrityOK - Data has not changed since signature capture. |
| 1 | NoSignature - No signature captured, or signature was captured without a hash. |
| 2 | DifferentHashType - Signature was captured with a different type of hash. |
| 3 | IntegrityFail - Data has changed since signature capture. |
| 4 | CheckError - Error checking signed data. |
renderBitmap
Renders a signature to a file or byte array.
| public native Object renderBitmap(String outputFilename, int dimensionX, int dimensionY, String mimeType, float inkWidth, int inkColor, int backgroundColor, float paddingX, float paddingY, int flags) | |
|---|---|
| Parameters | |
| outputFilename | The pathname of the file to receive the image output. May be null if byte array output is selected by flags. |
| dimensionX, dimensionY | X/Y dimensions specified as DPI (dots per inch) or Pixels. Negative value = DPI (the signature is not scaled). Positive value = Pixels (the signature is scaled to the dimensions) |
| mimeType | One of: image/bmp, image/jpeg, image/gif, image/tiff, image/png. |
| inkWidth | Ink width in millimeters. |
| inkColor, backgroundColor | Specifies the pen ink and background colors in MS COM COLORREF format (BGR). Examples: cWhite = 0xFFFFFF cBlack = 0x00 cRed = 0x0000FF |
| paddingX, paddingY | The specified padding is applied around the signature image, added to both the left and right for paddingX, and both the top and bottom for paddingY. X/Y dimensions are specified as mm or Pixels. Negative value = mm (1inch = 25.4mm) Positive value = Pixels |
| flags | Bitmask options: Output: outputBinary, outputBase64, outputFilenameColor: color1BPP, color24BPP, color32BPPExtras: backgroundTransparent, colorAntiAlias, encodeData, watermark |
| Return Value | |
| function dependent | |
| outputFilename | null |
| outputBinary | Byte array containing the image file contents |
| outputBase64 | String containing base-64 representation of image file data |
try
{
com.florentis.signature.SigObj sig = new com.florentis.signature.SigObj();
sig.sigText( readFileAsString("..\\dataJS1.txt"));
sig.renderBitmap("..\\temp1.png", -500, -500, "image/png", 1.0f, cRed, cBlue, -1.0f, -1.0f,
com.florentis.signature.SigObj.outputFilename | com.florentis.signature.SigObj.color32BPP);
}
catch (Exception e)
{
System.out.println("Exception:" + e);
}
renderRect
This method renders an image of the signature within a given rectangle on a specified device context.
public native void renderRect(long hdcTarg, long hdcRef, int left, int top, int right, int bottom, float inkWidth, int inkColor, int option, short zoom, short rotation) | |
|---|---|
| Parameters | |
| hdcTarg | Required long value specifying handle to the output device context. |
| hdcRef | Required long value specifying handle to reference device context. May be the same as hdcTarg. |
| left, top, right, bottom | Required int values defining the bounding rectangle in which the signature is to be rendered. |
| inkWidth | Optional float value specifying pen width in mm. Default is 0.7 mm. |
| inkColor | Optionally specifies the ink color using MS COM |
| option | Optional
|
| zoom | Optional short specifying the percentage by which the signature image is to be scaled. Default is 100%. |
| rotation | Currently unused. |
| Return Value | |
| None | |
readEncodedBitmap
This method reads the encoded SigObj data from an image file which was created using RenderBitmap()
| public native int readEncodedBitmap(String filename) | |
|---|---|
| Parameters | |
| filename | Required String containing the pathname of the image file that contains the encoded SigObj. |
| Return Value | |
| 0 | Signature data decoded OK |
| 1 | File not found |
| 2 | Bitmap is not a supported image type |
| 3 | Encoded signature data not found |
close
This method "Closes" the object, releasing the underlying COM object (and thus freeing resources).
| public native void close() | |
|---|---|
| Parameters | |
| None | |
| Return Value | |
| None |
Properties
| Property | Property Type | Description |
|---|---|---|
additionalData | int | Returns additional capture data (e.g. pad driver version) |
crossedOut | boolean | Read-only Boolean value is true if the signature appears crossed out as invalid |
extraData | String | Write once, Read string value referenced by key name or "" for all values |
height | int | Read-only value of the bounding rectangle of the signature in 0.01mm |
ink | String | Read/Write CIC Ink Tools interface value |
isCaptured | Boolean | Read-only value indicates if a signature has been captured |
sigData | byte[] | Read/Write binary SigObj data |
sigText | String | Read/Write hex string representation of sigData |
who | String | Read-only string containing signatory name |
why | String | Read-only string containing reason for signing |
when | Date | Returns the time & date of signature capture. when(0) = TimeLocal when(1) = TimeGMT |
width | int | Read-only value of the bounding rectangle of the signature in 0.01mm |