Signature Java API
Signature Java API
Introduction
The Signature Library includes a set of ActiveX components which provide the functionality for capturing and displaying signatures. This
document provides the information a Java developer needs to use the components, to be read in parallel with the Signature Library COM API.
Introduction
Class: SigCtl
Summary
Methods
aboutBox()
close()
Properties
Class: DynamicCapture
Summary
Methods
capture()
close()
Properties
Class: eSeal
Summary
Methods
capture()
close()
Properties
Class: Hash
Summary
Methods
add()
clear()
close()
Properties
Class: Key
Summary
Methods
set()
close()
Properties
Class: SigObj
Summary
Methods
checkIntegrity()
checkSignedData()
renderBitmap()
renderRect()
readEncodedBitmap()
close()
Properties
Class: WizCtl
Summary
Enumeration values
Methods
padConnect()
padDisconnect()
reset()
addObject()
addObject(ObjectText)
addObject(ObjectButton)
addObject(ObjectCheckbox)
addObject(ObjectRadioButton)
addObject(ObjectSignature)
addObject(ObjectInput)
addObject(ObjectInputEcho)
addObject(ObjectHash)
addObject(ObjectImage)
addObject(ObjectDisplayAtShutdown)
addObject(ObjectInking)
addPrimitive()
getObjectState()
setFont()
setEventHandler()
display()
fireClick()
processEvents()
endProcessEvents()
close()
Properties
Interface: WizCtl.WizCtlEvents
Methods
onPadEvent()
Class: InputObj
Summary
Methods
clear()
setEncryption()
close()
Properties:
Class: Font
Summary
Methods
close()
Properties
Class: ObjectOptions
Summary
Methods
setProperty()
close()
class FLSX
Summary
Methods
setLoader(ILoader)
Interface: FLSX.ILoader
Methods
loadLibrary()
Class: SigCtl
The class extends java.awt.Canvas to display an embedded signature object and provides a base class for DynamicCapture.
Full qualification: com.florentis.signature.SigCtl
Summary
Method
aboutBox
close
Property
signature
licence
Methods
aboutBox()
The method displays an About Box for the control. The dialog box will display version, licensing and contact information
Parameters:none
Parameters:none
Properties
Class: DynamicCapture
Summary
Method
capture
close
Property
licence
Methods
capture()
public static native int capture( SigCtl sigCtl, String who, String why, Hash what, Key key )
Parameters
close()
The method "Closes" the object, releasing the underlying COM object (and thus freeing resources).
Parameters:none
Properties
Class: eSeal
Summary
Method
capture
close
Property
url
hAlign
vAlign
hScale
vScale
transparency
cacheImage
width
height
name
id
licence
Methods
capture()
The method inserts an eSeal and optionally captures a handwritten signature.
public native int capture( SigCtl sigCtl, int captureMode, String who, String why, Hash what, Key key )
Parameters
close()
The method "Closes" the object, releasing the underlying COM object (and thus freeing resources).
Parameters:none
Properties
url String Read/Write String contains the URL of the image in a standard format:
JPEG, PNG, TIF, GIF, BMP
hAlign int Read/Write int defines horizontal alignment of the image as one of:
eSeal.esLeft
eSeal.esCentre (default)
eSeal.esCenter
eSeal.esRight
vAlign int Read/Write int defines vertical alignment of the image as one of:
eSeal.esTop
eSeal.esCentre (default)
eSeal.esCenter
eSeal.esBottom
cacheImage boolean Read/Write Boolean false if URL is to be accessed at time of signing, true if image is
saved
within the eSeal object. Defaults to false. For internal use only.
Class: Hash
The class is used to calculate a one-way hash, the value of which is a fixed length 'string', from an arbitrary length data set.
Full qualification: com.florentis.signature.Hash
Summary
Method
add
clear
close
Property
type
hash
Methods
add()
The method adds data to the Hash object
Parameters
boolean, byte, char, short, int, long, float, double, String, byte[]
Return Value: none
clear()
The method clears the Hash object.
Parameters:none
close()
The method "Closes" the object, releasing the underlying COM object (and thus freeing resources).
Parameters:none
Properties
type int Read/Write value sets the type of hashing algorithm to one of:
Hash.none
Hash.md5
Hash.sha1
Hash.sha224
Hash.sha256
Hash.sha384
Hash.sha512
Class: Key
Summary
Method
set
close
Property
type
Methods
set()
The method sets the type of the Key object
Parameters
Key.none
Key.md5
Key.sha1
Key.sha224
Key.sha256
Key.sha384
Key.sha512
close()
The method "Closes" the object, releasing the underlying COM object (and thus freeing resources).
Parameters:none
Properties
Key.none
Key.md5
Key.sha1
Key.sha224
Key.sha256
Key.sha384
Key.sha512
Class: 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()
The method checks the integrity of the Signature object to detect whether it has been tampered with since signing
Parameters
key Optional Key object. If not supplied the code uses Key type MD5 by default.
checkSignedData()
The method checks for a match between a given hash and that provided when the signature was captured.
Parameters
hash Required Hash object to be compared with the one provided when the signature was
captured
renderBitmap()
The method 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.
image/bmp
image/jpeg
image/gif
image/tiff
image/png
inkColor Specifies the pen ink and background colours in MS COM COLORREF format (BGR)
Examples:
backgroundColor
cWhite = 0xFFFFFF
cBlack = 0x00
cRed = 0x0000FF
paddingX 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.
paddingY
X/Y dimensions are specified as mm or Pixels.
outputFilename null
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()
The 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
left Required int values defining the bounding rectangle in which the signature is to be
top rendered
right
bottom
inkWidth Optional float value specifying width, in mm, of pen used to draw signature.
(Default is 0.7mm.)
inkColor Optionally specifies the pen ink and background colours in 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:
zoom Optional short value specifying percentage by which the signature image is to be
scaled. (Default is 100%.)
readEncodedBitmap()
The method reads the encoded SigObj data from an image file which was created using RenderBitmap()
Parameters
filename Required string contains the pathname of the image file containing the
encoded
SigObj
close()
The method "Closes" the object, releasing the underlying COM object (and thus freeing resources).
public native void close()
Parameters:none
Properties
additionalData int additionalData returns additional capture data eg 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
when Date when (int timeZone) returns the time & date of signature capture
when(0) returns TIimeLocal
when(1) returns TimeGMT
width int Read-only value of the bounding rectangle of the signature in 0.01mm
Class: WizCtl
The class extends java.awt.Canvas to reproduce the LCD display and provides the java interface to the COM control.
Full qualification: com.florentis.signature.WizCtl
Summary
Method
padConnect
padDisconnect
reset
addObject
addPrimitive
getObjectState
setFont
setEventHandler
display
fireClick
processEvents
endProcessEvents
close
Property
inkingPad
enableWizardDisplay
padWidth
padHeight
zoom
licence
Enumerations
ObjectType
PrimitiveType
AlignmentType
CheckboxOptions
PrimitiveOptions
EventType
InputOptions
EncryptionAlg
Enumeration values
ObjectType
objectText
objectButton
objectCheckbox
objectSignature
objectInput
objectInputEcho
objectRadioButton
PrimitiveType
primitiveLine
primitiveRectangle
primitiveEllipse
AlignmentType
textAlignLeft
textAlignRight
textAlignCentre
textAlignJustify
CheckboxOptions
checkboxUnchecked
checkboxChecked
checkboxDisplayTick
checkboxDisplayCross
CheckboxOptions
checkboxUnchecked
checkboxChecked
checkboxDisplayTick
checkboxDisplayCross
PrimitiveOptions
primitiveLineSolid
primitiveLineDashed
primitiveOutline
primitiveFill
primitiveFillXOR
EventType
evTextClicked
evButtonClicked
evCheckboxChecked
evCheckboxUnchecked
evInputMinReached
evInputMaxReached
evInputExceeded
InputOptions
echoNoSpacing
echoHalfSpacing
echoSingleSpacing
echoDoubleSpacing
echoUnderline
EncryptionAlg
encryptNone
encryptTripleDES
Methods
padConnect()
Connects to the signature tablet / pad.
Parameters:none
0 Success
padDisconnect()
Disconnects the signature tablet / pad.
Parameters:none
reset()
Disables events, removes all internal controls and prepares for setting the display. Does not change the current display
Parameters:none
addObject()
Adds an item to the pad control list.
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
x, y Position of the top left corner of the object on the pad display.
Value can either be absolute position in pixels, or one of the strings:
Return Value:none
addObject(ObjectText)
Displays a text string on the pad using the current font
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectText
id The following values have special meanings when used with a signature object:
"who"Text in Data will also be used as name of signatory.
"why"Text in Data will also be used as reason for signing.
"when"Reserved for future use
(Can be null or an empty string)
X, Y Position of the top left corner of the object on the pad display.
Value can either be absolute position in pixels, or one of the strings:
X: "left", "right", "centre"
Y: "top", "middle", "bottom"
Return Value:none
addObject(ObjectButton)
Creates a button – text surrounded by a rectangle which generates a click event when tapped with the pen. Text is displayed in the current font
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectButton
id The following values have special meanings when used with signature or input objects:
"Cancel" With a signature, clears any captured 'ink' and terminates input
X, Y Position of the top left corner of the object on the pad display.
Value can either be absolute position in pixels, or one of the strings:
X: "left", "right", "centre"
Y: "top", "middle", "bottom"
Return Value:none
addObject(ObjectCheckbox)
Creates a checkbox – a small rectangle followed by text which toggles its state and generates an event when tapped with the pen. Text is
displayed in the current font
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectCheckbox
id The following values have special meanings when used with a signature object.
Cannot be any of the values reserved for text or button objects: who, why, Ok, Clear, Cancel.
X, Y Position of the top left corner of the object on the pad display.
Value can either be absolute position in pixels, or one of the strings:
X: "left", "right", "centre"
Y: "top", "middle", "bottom"
Return Value:none
addObject(ObjectRadioButton)
Creates a radio button – a small circle followed by text. Radio buttons are used in groups where tapping on one with the pen selects it and
deselects the currently selected button in the group. Tapping with the pen also generates an event. Text is displayed in the current font
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectCheckbox
id The following values have special meanings when used with a signature object.
Cannot be any of the values reserved for text or button objects: who, why, Ok, Clear, Cancel.
X, Y Position of the top left corner of the object on the pad display.
Value can either be absolute position in pixels, or one of the strings:
X: "left", "right", "centre"
Y: "top", "middle", "bottom"
options ObjectOptions object specifying the name of the group to which this radio button belongs and, optionally, whether this
option is initially selected.
Return Value:none
addObject(ObjectSignature)
Puts the pad into signature capture mode and specifies a signature object or control in which a captured signature is saved. It is an error to add
more than one ObjectSignature to the current control list
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectSignature
id Cannot be any of the values reserved for text or button objects: who, why, Ok, Clear, Cancel;
can be null or an empty string
X, Y Values ignored
data A signature object or control. (Note: cannot be a SigCtlXHTML if an ObjectHash has been added)
options A Key object to use for setting integrity of captured signature. (Optional)
Return Value:none
addObject(ObjectInput)
Provides an input mechanism for PIN code entry.
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectInput
id Cannot be any of the values reserved for text or button objects: who, why, Ok, Clear, Cancel; can be null or an empty string
X, Y Values ignored
Return Value:none
addObject(ObjectInputEcho)
Specifies location of and character to use for ObjectInput 'echo'.
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectInputEcho
id Cannot be any of the values reserved for text or button objects: who, why, Ok, Clear, Cancel;
can be null or an empty string
X, Y Values ignored
Return Value:none
addObject(ObjectHash)
Supplies a Hash object representing data to be bound to a captured signature. It is an error to add more than one ObjectHash to the current
control list Cannot be used in conjunction with a SigCtlXHTML control (ie in a web page) as the latter automatically binds to the host document.
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectHash
id Cannot be any of the values reserved for text or button objects: who, why, Ok, Clear,
Cancel;
can be null or an empty string
X, Y Values ignored
Return Value:none
addObject(ObjectImage)
Displays an image on the pad. The image can optionally be made clickable in which case click events are generated when the image is tapped
with the pen.
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectImage
id Supports the same reserved Ids as button objects. See AddObject(ObjectButton) above
X, Y Position of the top left corner of the object on the pad display. Value can either be absolute position in
pixels,
or one of the strings:
X: "left", "right", "centre"
Y: "top", "middle", "bottom"
Return Value:none
addObject(ObjectDisplayAtShutdown)
Causes the current control set to remain displayed on the pad following disconnection.
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectDisplayAtShutdown
id Cannot be any of the values reserved for text or button objects: who, why, Ok, Clear,
Cancel;
can be null or an empty string
X, Y Values ignored
Return Value:none
addObject(ObjectInking)
Provides a mechanism for capturing pad 'ink' as an image
public native void addObject( int type, String id, Object x, Object y, Object data, Object options )
Parameters:
type ObjectInking
X, Y Values ignored
Return Value:none
A snapshot of current ink is retrieved, in PNG format as a base-64 encoded string, using the WizCtl GetProperty method as follows:
pngAsText = wizctl.getProperty("ObjectInking_Bitmap");
Alternatively, the image can be written to a file using SetProperty. The format of the image is determined by the file name extension (bmp, jpg,
png or tif):
wizctl.setProperty("ObjectInking_Bitmap", "c:\\file.png");
In both cases, the size of the image is the size of the LCD screen
addPrimitive()
Adds a graphics primitive item to the internal list.
public native void addPrimitive( int type, Object x1, Object y2, Object x2, Object y2, Object primdata, Object options )
Parameters:
x1, y1 If Type is PrimitiveLine, start position of line, otherwise position of top-left corner of bounding rectangle of item.
Value can be the absolute position in pixels or one of the strings:
"left", "right", "centre" (for X1) or "top", "middle", "bottom" (for Y1).
x2, y2 If Type is PrimitiveLine, end position of line, otherwise position of bottom-right corner of bounding rectangle of
item.
Value can be the absolute position in pixels, one of the strings:
"left", "right", "centre" (for X2) or "top", "middle", "bottom" (for Y2)
or a string in the format "+V" or " V" (where V is an integer) for a value relative to X1 or Y1.
Return Value:none
getObjectState()
Returns state information of a given object or an empty Variant if specified object does not exist.
Parameters:
id Identifier of object.
setFont()
Sets the current font for new wizard objects.
Parameters:
Return Value:none
setEventHandler()
Sets the function to be called to handle tablet control events.
Parameters:
Return Value:none
display()
Clears current display contents, turns on backlight (if not already on), updates display with all buffered objects and primitives and enables event
handling.
Parameters:none
Return Value:none
fireClick()
Simulates 'click' on an object (button, checkbox, image etc).
Allows, for example, a signature to be accepted by clicking a button on the PC screen rather than taping the OK button on the pad.
Parameters:
Return Value:none
processEvents()
NOTE: This has no equivalent (nor is needed) in the Microsoft COM interface.
Once display() has been called, call this method to wait for input from the pad, which is delivered through implementing onPadEvent().
This call does not return until onPadEvent() returns false, the thread is interrupted or endProcessEvents() is called.
Parameters: none
Return Value:none
endProcessEvents()
Terminates endProcessEvents()
NOTE: This has no equivalent (nor is needed) in the Microsoft COM interface.
Call this method to signal the processEvents method to terminate and return.
Parameters: none
Return Value:none
close()
"Closes" the object, releasing the underlying COM object (and thus freeing resources).
Note that, while the COM object is also released by finalize() during garbage collection, experience has shown that creating numerous WizCtl
objects, for example as part of a frequently repeated process, can lead to problems if close() calls are not used.
public native void close()
Parameters: none
Return Value:none
Properties
inkingPad boolean Read-only boolean, True if the pad has a supported LCD display
Interface: WizCtl.WizCtlEvents
This interface when implemented provides feedback events when an action is taken on the pad.
NOTE: This has slightly different behaviour than the COM version.
Full qualification: com.florentis.signature.WizCtl.WizCtlEvents
Methods
onPadEvent()
This is only called from within WizCtl.processEvents(). Return true to continue processing events or return false for processEvents() to return.
Parameters:
continue Return true to continue processing events or return false for processEvents() to return.
Class: InputObj
The class provides the Input control for PIN code input
Full qualification: com.florentis.signature.WizCtl.InputObj
Summary
Method
clear
setEncryption
close
Property
minLength
maxLength
text
data
encryptionType
Methods
clear()
Resets the input object ready to restart PIN capture.
Parameters:none
Return Value:none
setEncryption()
Sets the encryption of the InputObject data.
Once set, encryption cannot be changed except by first calling the Clear method.
Currently, the only encryption algorithm supported is TripleDES. For this algorithm, "Key" must be a 24-byte (192-bit) binary value either in a
byte array (a SafeArray of type VT_UI1) or a base64 encoded string. In addition, the following information will be required for decryption:
Cipher mode:CBC (cipher block chaining)
Initialisation Vector:8 bytes, all zero
Padding mode:PKCS 5
Parameters:
Return Value:none
close()
"Closes" the object, releasing the underlying COM object (and thus freeing resources).
Parameters:none
Return Value:none
Properties:
Property Type Description
text String Read-only String containing the input data (optionally encrypted)
Class: Font
Summary
Method
close
Property
name
size
bold
underline
strikethrough
weight
Methods
close()
"Closes" the object, releasing the underlying COM object (and thus freeing resources).
Parameters:none
Return Value:none
Properties
Class: ObjectOptions
Summary
Method
setProperty
close
Property
none
Methods
setProperty()
Parameters:
Return Value:none
Remarks:
The supported properties depend on the type of wizard object being added:
WizCtl.objectButton
Property Value
WizCtl.objectInputEcho
Property Value
CharSet Single character string specifying character to display as echo (eg, "*" for password entry)
WizCtl.objectRadioButton
Property Value
close()
"Closes" the object, releasing the underlying COM object (and thus freeing resources).
Parameters:none
Return Value:none
class FLSX
This class allows an application to provide a custom loader for the native library.
Full qualification: com.florentis.signature.FLSX
Summary
Method
setLoader
Methods
setLoader(ILoader)
Parameters:
For example, the following code replicates the default loader from previous and current versions:
Interface: FLSX.ILoader
Provides the mechanism to replace the standard native library loader. See FLSX.setLoader() for more details.
Full qualification: com.florentis.signature.FLSX.ILoader
Methods
loadLibrary()
This will only be called once. See FLSX.setLoader().
Parameters:
none