General
Please note: The API reference manual mentioned several times in the article below is called Signature-Components-API.pdf and is provided in the "Documentation" folder of the Signature SDK for Windows download file which can be found under "For signature" here.
How do I change font width and colour?
First of all please make sure that you are using a signature device which supports colour if you want to set it.
For example, the STU-500 and STU-430 are monochrome pads and do not support colour.
There are four places where colour and ink width can be defined:
- In the images (text and buttons etc.) which are displayed on the signature pad
- In the inking which is produced on the pad itself when it is signed with the pen
- On the form (e.g. the HTML canvas or Windows image) in the application where the signature is rendered after being captured
- In the image which is generated and saved to disk
Images displayed on the signature device
1) Business Solution Displays such as DTH-1152, DTU-1141B
These pen input devices do not support the wizard control so the setting of font colour and width is limited to the inking on the signature capture window as the pen is writing.
This is done via the sigCtl properties or registry entries CaptureInkWidth and CaptureInkColor. For further information please see below in the section on "Inking on the pad while signing is in progress".
2) STU pads
- Using the wizard control (WizCtl):
a) Image upload: In this situation the pad will simply render the image as it receives it from the operating system. If font colours or size need to be changed this must be done by editing the original image on disk.
b) Adding objects such as buttons, text, radio or check boxes: colour and font size is controlled by setting the font size and colour as required in the code before adding the objects to the WizCtl.
- Using the signature control (SigCtl):
In the case of the SigCtl (dynamic capture) customisations to the signature capture display on the pad are only possible via registry entries as described in the "Configuration (Registry Settings)" section of the reference manual.
Please see also the screenshot in the following section below.
Inking on the pad while signing is in progress
This can be controlled by means of two properties - CaptureInkWidth and CaptureInkColor as specified in the API reference manual. Here is an example for HTML:
var dc = new ActiveXObject("Florentis.DynamicCapture");
dc.SetProperty("CaptureInkWidth", "5");
dc.SetProperty("CaptureInkColor", "0,0,1");
var rc = dc.Capture(sigCtl, "who", "why");
These properties can also be set in the registry - the disadvantage of this is that they then become permanent values for the current user until they are changed or disabled.
They can however be overridden by setting the corresponding properties in the application as illustrated above.
The registry settings must be placed in HKEY_LOCAL_MACHINE\Software\Florentis\sd or HKEY_LOCAL_MACHINE\Software\WOW6432Node\Florentis\sd if using a 32-bit SDK installation on a 64-bit operating system.
Here is an example of how the registry settings would look in regedit:
The signature as rendered in the application after capture
The ink width and colour of the signature can be set from the application via the InkColor and InkWidth properties of the sigCtl object as defined in the API reference manual.
The colour and font used for other features of the image of the captured signature such as the who, why and when values and the colour of the signature line can be controlled using ForeColor and BackColor properties of the same sigCtl.
Please note that the BackColor property of the SigCtl only has an effect if the BackStyle is set to 0.
Here is an example of JavaScript extracted from an HTML form showing all the types of font width and colour listed above:
var sigCtl = document.getElementById("sigCtl1");
sigCtl.Licence = "AgAkAEy2cKydAQVXYWNvbQ1TaWduYXR1cmUgU0RLAgKBAgJkAACIAwEDZQA";
// Set the ink colour and width displayed on the signature control on the HTML form.
sigCtl.InkColor = 0x0000AA;
sigCtl.InkWidth = 1;
sigCtl.BackStyle = 0; // Force the background style to 0 for opaque so that background colour can also be set on the control.
// The next 3 properties indicate that the who, when and why values should be displayed on the signature control along with the signature
sigCtl.ShowWhen = ShowText.TxtShowLeft;
sigCtl.ShowWho = ShowText.TxtShowRight;
sigCtl.ShowWhy = ShowText.TxtShowCenter;
// BackColor and ForeColor set the background colour of the signature control plus the colour of the signature line
// and the who, when and why text (but not the signature itself)
sigCtl.BackColor = 0x00FF00;
sigCtl.ForeColor = 0x0000FF;
var dc = new ActiveXObject("Florentis.DynamicCapture");
// CaptureInkWidth sets the width of the inking on the capture window which appears on the PC monitor but not the width of ink on the signature capture device itself
dc.SetProperty("CaptureInkWidth", "2");
dc.SetProperty("CaptureInkColor", "0,1,0"); // Sets the colour of the ink on the PC monitor as well as on the capture device
var rc = dc.Capture(sigCtl, "who", "why");
The image which is saved to disk
Signature images are saved to disk using the API method RenderBitmap(). This has three parameters relating to the signature inking - inkWidth, inkColor and backgroundColor - as specified in the API reference manual.
inkWidth - a value in millimetres.
inkColor - a value in OLE_COLOR format e.g. 0x0000FF is red and 0xFFFFFF is white
backgroundColor - as above
Here is an example from one of our JavaScript samples:
rc = sigCtl.Signature.RenderBitmap(filename, 300, 150, "image/png", 0.5, 0xff0000, 0xffffff, 0.0, 0.0, flags );