Skip to main content

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
keyOptional Key object. If not supplied, MD5 is used by default.
Return Value
checkIntegrityResult
0integrityOK – Data has not changed since signature capture.
1integrityFail – Data has changed since signature capture.
2integrityMissing – Signature integrity value not found.
3integrityWrongType – 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
hashRequired Hash object to be compared with the one provided when the signature was captured
Return Value
checkIntegrityResult
0integrityOK - Data has not changed since signature capture.
1NoSignature - No signature captured, or signature was captured without a hash.
2DifferentHashType - Signature was captured with a different type of hash.
3IntegrityFail - Data has changed since signature capture.
4CheckError - 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
outputFilenameThe pathname of the file to receive the image output. May be null if byte array output is selected by flags.
dimensionX, dimensionYX/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)
mimeTypeOne of: image/bmp, image/jpeg, image/gif, image/tiff, image/png.
inkWidthInk width in millimeters.
inkColor, backgroundColorSpecifies the pen ink and background colors in MS COM COLORREF format (BGR). Examples:

cWhite = 0xFFFFFF
cBlack = 0x00
cRed = 0x0000FF
paddingX, paddingYThe 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
flagsBitmask options:

Output: outputBinary, outputBase64, outputFilename
Color: color1BPP, color24BPP, color32BPP
Extras: backgroundTransparent, colorAntiAlias, encodeData, watermark
Return Value
function dependent
outputFilenamenull
outputBinaryByte array containing the image file contents
outputBase64String containing base-64 representation of image file data
Example
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
hdcTargRequired long value specifying handle to the output device context.
hdcRefRequired long value specifying handle to reference device context. May be the same as hdcTarg.
left, top, right, bottomRequired int values defining the bounding rectangle in which the signature is to be rendered.
inkWidthOptional float value specifying pen width in mm. Default is 0.7 mm.
inkColor

Optionally specifies the ink color using MS COM COLORREF format (BGR). Default is black.
Examples:
cWhite = 0xFFFFFF
cBlack = 0x00
cRed = 0x0000FF

option

Optional int value specifying the scaling mode of the rendered signature, with possible values:

  • 0dspForceFit: Scale signature to exactly fit the bounding rectangle (default)
  • 1dspUseZoom: Scale signature according to the Zoom argument
  • 2dspBestFit: Reduce size of signature to fit area if it is too big
zoomOptional short specifying the percentage by which the signature image is to be scaled. Default is 100%.
rotationCurrently 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
filenameRequired String containing the pathname of the image file that contains the encoded SigObj.
Return Value
0Signature data decoded OK
1File not found
2Bitmap is not a supported image type
3Encoded 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

PropertyProperty TypeDescription
additionalDataintReturns additional capture data (e.g. pad driver version)
crossedOutbooleanRead-only Boolean value is true if the signature appears crossed out as invalid
extraDataStringWrite once, Read string value referenced by key name or "" for all values
heightintRead-only value of the bounding rectangle of the signature in 0.01mm
inkStringRead/Write CIC Ink Tools interface value
isCapturedBooleanRead-only value indicates if a signature has been captured
sigDatabyte[]Read/Write binary SigObj data
sigTextStringRead/Write hex string representation of sigData
whoStringRead-only string containing signatory name
whyStringRead-only string containing reason for signing
whenDateReturns the time & date of signature capture.
when(0) = TimeLocal
when(1) = TimeGMT
widthintRead-only value of the bounding rectangle of the signature in 0.01mm