Signing Documents with the Angular DocumentViewer
The TX Text Control DocumentViewer for Angular can be used to request signatures for an electronic document signing process. This tutorial shows how to request a signature.

The DocumentViewer that is available for ASP.NET, ASP.NET Core and Angular can be used to request signatures from multiple users. These documents can be prepared using the TX Text Control document editor by adding Text
Creating the Template
Using the document editor, insert a text frame at the desired location:
Select the text frame and set a name for example to txsign:
Setting Up the DocumentViewer
Create an Angular application using the DocumentViewer as described in our documentation:
In the app.component.html, define the signatureSettings:
<tx-document-viewer
width = "800px"
height = "800px"
basePath = "https://backend.textcontrol.com?access-token=yourtoken"
documentData = "SGVsbG8gdGhlcmU="
dock = "Fill"
[toolbarDocked] = "true"
[isSelectionActivated] = "true"
[showThumbnailPane] = "true"
[signatureSettings] = "{
showSignatureBar: true,
signatureBoxName: 'txsign',
redirectUrlAfterSignature: 'https://www.textcontrol.com',
ownerName: 'Paul', signerName: 'Jacob',
signerInitials: 'PK' }">
</tx-document-viewer>
The various settings are explained in the documentation.
Essentially, you define a signer name, a unique document envelope ID and the signature box name that should match your text frame name (txsign). If your document you loaded through the documentData attribute contains signature boxes, the signature request process will be started automatically.
Loading the Document using JavaScript
In a typical Angular workflow, you would initiate the document viewer without loading a document. The document is then loaded dynamically using JavaScript by passing the signatureSettings object as a parameter in the loadDocument method.
In the app.component.html, an input form element is added to load a local document (for demo purposes):
<tx-document-viewer
width = "800px"
height = "800px"
basePath = "https://backend.textcontrol.com?access-token=yourtoken"
dock = "Fill"
toolbarDocked = true
isSelectionActivated = true
showThumbnailPane = true>
</tx-document-viewer>
<div class="fileButtons">
<input (change)="onChangeLoad($event)" type="file" id="fileinput" />
</div>
In the app.component.ts, call the custom JavaScript method readDocument to load the document:
import { Component } from '@angular/core';
declare const readDocument: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'my-viewer-app-sp3';
onChangeLoad(event: any) {
readDocument(event);
}
}
The readDocument JavaScript method loads the document, sets the document name and is passing a signatureSettings object to the loadDocument method as an attribute:
var signatureSettings = {
signerName: "Tim Typer",
signerInitials: "TT",
uniqueId: "12345-ABCDE",
redirectUrlAfterSignature: null,
ownerName: "Document Requestor",
signatureBoxName: "txsign",
showSignatureBar: true }
function readDocument(input) {
input = input.srcElement;
if (input.files && input.files[0]) {
var fileReader = new FileReader();
fileReader.onload = function (e) {
TXDocumentViewer.loadDocument(
e.target.result.split(',')[1],
input.files[0].name,
signatureSettings);
};
// read the file and convert it to Base64
fileReader.readAsDataURL(input.files[0]);
}
}
After loading the document, the signing process is started automatically:
Test this on your own and create your trial access token today.
Also See
This post references the following in the documentation:
- Javascript: TXText
Control.load Document Method - Javascript: TXText
Control Object
Angular
Integrate document processing, editing, sharing, collaboration, creation, electronic signatures, and PDF generation into your Angular Web applications.
Related Posts
AngularASP.NETDocument Signing
DocumentViewer Feature: Uploading Signature Images
A very popular feature of the DocumentViewer is the possibility to request signatures from multiple users for a document. A new feature allows users to upload and adjust prepared signature images.
AngularASP.NET CoreDocument Viewer
Asynchronous Loading and Saving in Angular Document Editor with an ASP.NET…
This article shows how to load and save documents in an Angular Document Editor using an ASP.NET Core Web API asynchronously. A Web API is used to load and save documents from and to the server…
Getting Started: Loading and Saving Documents using Angular
This article shows how to load and save documents using the Angular Document Editor. It explains how to use the Angular Document Editor in an Angular application and how to load from a URL and how…
Angular: Loading Excerpt JSON Data on Initializing TX Text Control
Data excerpt files are used to provide the data structure that is used to fill the merge field drop-down lists. This article shows how to load JSON data into the Angular editor.
ASP.NETDocument SigningSamples
New DocumentViewer Signature Tutorial Sample
We just published a new tutorial sample in our demo hub that shows how to prepare documents with signature boxes to request signatures using the DocumentViewer.