PrizmDoc Viewer v13.6 - Updated
Class: Signature Control
API Reference > Viewer API > Class: Signature Control

Class: SignatureControl

PCCViewer. SignatureControl

new SignatureControl(dom)

Creates a new signature drawing context in the given DOM element.

Parameters:
Name Type Description
dom HTMLElement | string

A DOM Element, or a string representing a valid query selector. This DOM element will be converted to a drawable area, so that the user can sign inside it. It can be styled any way you wish. However, this element must be visible on the page when the SignatureControl is initialized.

Throws:
  • If the parameter passed in is not an HTML Element or a string.

    Type
    Error
  • If the query selector string did not match any element.

    Type
    Error
Examples
// find the DOM element to use
var domElement = docuent.querySelector('#myDrawingArea');
// configure the control
var signatureControl = PCCViewer.SignatureControl(domElement);
// shorthand to use the query selector direcly
var signatureControl = PCCViewer.SignatureControl('#myDrawingArea');

Methods

cancel() → {PCCViewer.SignatureControl}

Destroys the signature control and returns the HTMLElement back to its original state. Any drawn elements will be discarded and no PCCViewer.Signatures~FreehandSignature will be created.

Returns:

The SignatureControl that owns the method.

Type
PCCViewer.SignatureControl

clear() → {PCCViewer.SignatureControl}

Removes all drawn lines from the signature control.

Returns:

The SignatureControl that owns the method.

Type
PCCViewer.SignatureControl

done() → {PCCViewer.Signatures~FreehandSignature}

Creates a new PCCViewer.Signatures~FreehandSignature object from the elements drawn inside the SignatureControl. This method will also return the HTML Element that the SignatureControl was embedded in back to its original state.

If no content is drawn, the path returned by this method will be M0,0, which is the shortest valid path which indicates that there is no content.

Returns:

The newly created signature.

Type
PCCViewer.Signatures~FreehandSignature

resize() → {PCCViewer.SignatureControl}

Reinitializes the size of the drawing area, so that the drawing area fits the entire size of the HTMLElement. Content already drawn in the area will remain unchanged.

Returns:

The SignatureControl that owns the method.

Type
PCCViewer.SignatureControl

undo() → {PCCViewer.SignatureControl}

Removes the last drawn line from the signature control.

Returns:

The SignatureControl that owns the method.

Type
PCCViewer.SignatureControl