We released a new version of the DocumentViewer for ASP.NET Core and ASP.NET that supports server-side signature processing and custom signing processes.

NuGet Package

More information and installation instructions can be found in our NuGet Gallery.

TXTextControl.Web.DocumentViewer

Default Signing Process

In the default signing process, users sign a document and click the Submit button to submit the signature data such as the electronic signature image and form field data. The server-side DocumentViewer controller is processing the signature and creates a document with the patched electronic signature. This document is then returned to a client-side callback that is defined through the signatures.setSubmitCallback method:

window.addEventListener("documentViewerLoaded", function () {
TXDocumentViewer.signatures.setSubmitCallback(exportPDF);
});
view raw test.js hosted with ❤ by GitHub

From there, it can be used to create a digitally signed PDF in a separate, external method. The overall workflow is shown in the following sequence diagram:

Signature Workflow Sequence Diagram

Redirect URL

In the new version (>= 30.0.402.500), a redirect URL can be provided using the RedirectUrlAfterSignature property (or the signatures.setRedirectUrl JavaScript method) that is used to forward the signature data and/or signed document from the integrated DocumentViewer server-side controller. The following code shows how to attach the custom controller method MyController/HandleSignature:

@Html.TXTextControl().DocumentViewer(settings => {
settings.DocumentPath =
AppDomain.CurrentDomain.GetData("DataDirectory").ToString() + "\\test.tx";
settings.SignatureSettings = new SignatureSettings() {
ShowSignatureBar = true,
OwnerName = "Josh Jackson",
SignerName = "Peter Petersen",
SignerInitials = "PP",
SignatureBoxName = "txsign",
UniqueId = "12345-12345-12345-12345",
RedirectUrlAfterSignature = this.Url.Action(
"HandleSignature",
"MyController",
null,
Request.Url.Scheme,
null)
};
}).Render()
view raw test.cshtml hosted with ❤ by GitHub

After the user signed the document, the electronic signature is patched to the document and forwarded to the given URL including signature data such as the signature image and timestamp information. The following sequence diagram shows this workflow:

Signature Workflow Sequence Diagram

A custom HttpPost method can be used to handle the signature data:

[HttpPost]
public string HandleSignature(
[FromBody] TXTextControl.Web.MVC.DocumentViewer.Models.SignatureData data)
{
var test = data.SignedDocument.Document; // signed document
// ...
return "";
}
view raw test.cs hosted with ❤ by GitHub

The public SignatureData model is part of the DocumentViewer:

Signature Workflow Sequence Diagram

This data can be used to process the signed document in a separate, custom process without sending the document back from client-side for further processing. In the above sequence diagram can be seen that the return value of the custom controller method is forwarded to the callback that has been defined using setSubmitCallback. This return value can be simply a 200, the complete document or anything else.

Redirect and Custom Signing

A third way is to process the complete signing in a custom controller method. In this case, the JavaScript method setCustomSigning can be used to define whether the DocumentViewer is executing the signature process or if this should be handled by a custom method:

window.addEventListener("documentViewerLoaded", function () {
TXDocumentViewer.signatures.setCustomSigning(true);
TXDocumentViewer.signatures.setSubmitCallback(signatureComplete);
});
view raw test.js hosted with ❤ by GitHub

In this case, only the signature data is forwarded to the given URL for custom processing:

Signature Workflow Sequence Diagram

Conclusion

Whether for security reasons or custom signature requirements, it might be useful to handle the signature process completely server-side. A new feature can be used to retrieve signature data such as the electronic signature image data, timestamp and other related information for a custom signing process.

Feel free to reach out to us, if you have any questions about these workflows. Our engineers can help with your custom requirements for a secure, reliable and integrated electronic signature workflow.