Products Technologies Demo Docs Blog Support Company

Sneak Peek: Retrieving Timestamped Raw Signature Data

We are working on a feature for the Document Viewer that will return the raw signature data from the signature soft pad. This article will provide you with an overview of the functionality and the use cases.

Sneak Peek: Retrieving Timestamped Raw Signature Data

The signature soft pad, which is included with the Document Viewer, is used to capture a signer's graphic signature. This SVG image is patched into the signature field and digitally signed.

This process is already secure because the data is added, the signature is added and the document is digitally signed and therefore tamper-proof. However, there are some legal requirements that make it necessary to prove that a signature belongs to a particular person. Therefore, the raw signature data will be available in a future version of the Document Viewer.

Signature Points

An array of SignaturePoint arrays is included in the SignatureData object passed by the viewer. The location of each captured signature point and a timestamp are stored in the SignaturePoint class.

Learn More

Learn how to handle signature requests server-side. The most common server-side Web API methods for handling electronic signatures are described in this article.

Common Web API Methods for Handling E-Signature Workflows in ASP.NET Core C#

Calculate the Duration

For example, you can use this jagged array to calculate the total time of signature capture.

[HttpPost]
public string HandleSignature([FromBody] SignatureData data) {

  var signatureLines = data.SignatureLines;

  var startTime = DateTimeOffset.FromUnixTimeMilliseconds(signatureLines[0][0].CreationTimeStamp).DateTime;
  var endTime = DateTimeOffset.FromUnixTimeMilliseconds(signatureLines[0][signatureLines[0].Length - 1].CreationTimeStamp).DateTime;

  var duration = endTime - startTime;

  //...
}

This array could be serialized and stored in a database or encrypted in the document for later comparison with the actual signature stored for the signer. In the event that the signer doesn't have a specific signature stored, the way in which the signer creates his or her own signature can be played back and compared.

Replay the Signature

Based on the timestamps, the following JavaScript code replays the array, including the write speed.

async function handleSignature() {
    const canvas = document.getElementById("signature");
    const ctx = canvas.getContext("2d");
    const signature = JSON.parse(json);

    ctx.beginPath();
    ctx.strokeStyle = "blue";
    ctx.lineWidth = 5;

    for (let i = 0; i < signature[0].length; i++) {
        const { x, y, creationTimeStamp } = signature[0][i];

        if (i === 0) {
            ctx.moveTo(x, y);
        } else {
            const duration = creationTimeStamp - signature[0][i - 1].creationTimeStamp;
            await drawLine(ctx, x, y, duration);
            ctx.stroke();
        }
    }
}

function drawLine(ctx, x, y, duration) {
    return new Promise((resolve) => {
        setTimeout(() => {
            ctx.lineTo(x, y);
            resolve();
        }, duration);
    });
}

This can be used to compare a signer's actual signing with stored signature data.

Signature Replay

The new feature adds an extra layer of security to the process of signing electronic documents.

Stay tuned for more features!

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ASP.NETWindows FormsWPF

TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 3 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…


ASP.NETASP.NET CoreDocument Viewer

High-Performance Text Replacement in Large DOCX Files using C# .NET

Learn how to efficiently replace text in large DOCX files using C# .NET and the ServerTextControl component from Text Control. This article demonstrates the performance benefits of using the…


ASP.NETASP.NET CoreDocument Viewer

Document Viewer 33.2.1 Released: New Event and Bug Fixes

This service pack includes important bug fixes and improvements to enhance the stability and performance of the Document Viewer. In addition, a new event has been introduced to provide developers…


ASP.NETAccessibilityASP.NET Core

Upcoming Support for PDF/UA Compliance and Tagged PDF Generation in Version 34.0

We are happy to announce that version 34.0 will support PDF/UA compliance and the creation of tagged PDF documents. This significant update demonstrates our ongoing commitment to accessibility by…


ASP.NETWindows FormsWPF

TX Text Control 33.0 SP2 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 2 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…