PrizmDoc v12.4 - Updated
Class: SignatureDisplay

Class: SignatureDisplay

PCCViewer. SignatureDisplay

new SignatureDisplay(domElement, signature) → {Object}

Builds a DOM preview of the signature, to be used to display the signature outside of the viewer.

Parameters:
Name Type Description
domElement HTMLElement

The element in which to insert signature preview.

signature Object | PCCViewer.Signatures~FreehandSignature | PCCViewer.Signatures~TextSignature

The signature object to render in the preview.

Throws:
  • If the domElement parameter is undefined or not a valid HTMLElement.

    Type
    Error
  • If the signature parameter is undefined.

    Type
    Error
  • If the signature.path property, in a FreehandSignature object, contains invalid data.

    Type
    Error
  • If the signature.text property, in a TextSignature object, is not a string.

    Type
    Error
Returns:

An Object that contains the following properties:

  • width {Number} The calculated width of the signature in pixels.
  • height {Number} The calculated height of the signature in pixels.
  • clear {Function} Remove all inserted content from the original HTMLElement.

Note: the width and height of a text signature will always be calculated using a 12 point font.

Type
Object
Example
// create a signature and a div
var signature = { path: "M0,0L100,0L100,100L0,100L0,0" };
var div = document.createElement('div');

// generate the signature preview
PCCViewer.SignatureDisplay(div, signature);

// display the div now
document.body.appendChild(div);