renderBitmap
Renders an image of the signature. Optionally, it encodes the SigObj in the generated image using steganographic techniques.
await sigObj.renderBitmap(renderWidth, renderHeight, mimeType, inkWidth, inkColor, inkBackground, paddingX, paddingY, flags)
| Parameters |
|---|
| renderWidth: int value indicating the width specified as DPI (dots per inch) or pixels. Negative value = DPI (the signature is not scaled). Positive value = pixels (the signature is scaled to fit the area). |
| renderHeight: int value indicating the height specified as DPI (dots per inch) or pixels. Negative value = DPI (the signature is not scaled). Positive value = pixels (the signature is scaled to fit the area). |
mimeType: String specifying the image format as one of:
|
| inkWidth: float value with the signature ink width in pixels. |
| inkColor: String with the signature ink colour. |
| inkBackground: String with the image background colour. |
paddingX, paddingY: float values with the padding around the signature image, added to both the left and the right for paddingX, and both the top and bottom for paddingY. Dimensions are specified as mm or pixels.
|
flags: int value with a combination of sigSDK.RenderFlags values. Use the value property of each flag, for example sigSDK.RenderFlags.RenderEncodeData.value. |
The following flags are supported:
RenderEncodeData- Encodes the signature data within the image. Only valid for PNG.RenderClipped- Crops the signature image, omitting any parts that were outside the original capture window.RenderRelative- Renders the signature image relative to the origin of the original capture window. Dimensions must be equal DPI (negative) values, and padding values must be 0.
Other sigSDK.RenderFlags values exist but are not supported.
| Return values |
|---|
| The function returns a promise that resolves to an image URL (String) when it succeeds, or raises an exception if it fails. |
The following example renders the signature as a PNG with the signature data encoded in it:
const image = await sigObj.renderBitmap(300, 150, "image/png", 3.0, "blue", "white", 0, 0,
sigSDK.RenderFlags.RenderEncodeData.value);
document.getElementById("signatureImage").src = image;