Zum Hauptinhalt springen

getSignatureImageBlob

This function returns the signature drawn in a signature control as an image blob. The blob can be either in PNG (default) or SVG format. You can use this blob to display the signature in a different control, print it, or save it as an attachment.

Syntax

app.getSignatureImageBlob(controlId, type)

Parameters

ParameterTypeDescription
controlIdStringThe ID of the signature control containing the signature
typeString(Optional) The format of the image. If set to "svg", returns an SVG vector image. If not specified, returns a PNG image

Return Value

Returns a Promise that resolves to a Blob object containing the signature image in the specified format.

Examples

Example 1: Get a signature as PNG and display it in a document viewer:

const signatureBlob = app.getSignatureImageBlob("signatureField");
app.showBlob("signaturePreview", signatureBlob);

Example 2: Get a signature as SVG and save it as an attachment:

const signatureBlob = app.getSignatureImageBlob("customerSignature", "svg");
app.uploadBlobAsAttachment(signatureBlob, "signature.svg");

Example 3: Print a signature directly:

const signatureBlob = app.getSignatureImageBlob("contractSignature");
app.printBlob(signatureBlob);

Example 4: Save a signature into the current record as an attachment:

// Get the signature as PNG
const signatureBlob = app.getSignatureImageBlob("employeeSignature");

// Upload as an attachment to the current record
const attachmentId = app.uploadAttachment(
signatureBlob,
5, // Document type ID for signatures
"employee_signature.png"
);

// Store the attachment ID in a form field for reference
app.setFieldValue("signatureAttachmentId", attachmentId);
  • showBlob() - For displaying the signature blob in a docViewer control
  • uploadAttachment() - For saving the signature as an attachment
  • printBlob() - For printing the signature directly
  • uploadBlobAsAttachment() - For uploading the blob as an attachment to the current record

Notes

  • The signature must be drawn in the control before calling this function
  • If the signature control is empty, the function will return an empty blob
  • PNG format is suitable for most uses and provides a raster image
  • SVG format provides a vector image that can be scaled without quality loss
  • The blob returned by this function can be used directly with other blob-handling functions
  • For web applications, PNG format is generally more compatible across browsers