Deploying Documents with Annotations
The DocumentViewer allows to add and share annotations from different users to any type of document supported by TX Text Control including PDF, DOC, DOCX, RTF and the internal TX Text Control format (TX). This article shows how to deploy a document with additional, separate annotations.

The TX Text Control DocumentViewer, part of TX Text Control .NET Server, allows you to add and share annotations from different users to any type of document supported by TX Text Control including PDF, DOC, DOCX, RTF and the internal TX Text Control format (TX). This feature allows the easy integration of document collaboration workflow features into your TX Text Control based applications.
This feature can be also used to deploy documents or forms with additional information such as descriptions or instructions on how to fill out form fields or where to sign a document. This feature can be compared to old-fashioned "post-it" notes on paper documents. The advantage of the annotations is that you can deploy a document to users with customized notes.
Deploying Documents
Consider a user case where an invoice is shared with a client in a dedicated invoice portal and a significant change should be highlighted in the document:
Loading and Saving Annotations
The annotations can be created using the DocumentViewer and exported externally as a JSON string with the following code:
TXDocumentViewer.annotations.export();
The following is the result of the above sample (minimized for demo purposes):
[
[
{
"pen":{
"width":4,
"color":"rgba(255, 0, 0, 1)",
"cap":"round",
"refine":"catmull",
"composite":"destination-over"
},
"user":"Tim Typer",
"lines":[
{
"x":517.7310513447433,
"y":699.2860635696821
},
...
],
"time":1641558031513,
"comments":[
],
"id":"6198b457-1257-4ce5-96f5-1f2cc6eb9c28"
},
{
"pen":{
"type":"text",
"color":"rgba(255, 0, 0, 1)",
"composite":"destination-over",
"font":"Arial",
"size":"24",
"weight":"normal",
"style":"normal"
},
"user":"Tim Typer",
"text":"New price!",
"location":{
"x":517.7310513447433,
"y":779.0904645476772
},
"time":1641558039723,
"comments":[
],
"id":"9269bdf0-9130-40ca-891a-613f0993159c"
}
],
[
],
[
]
]
When deploying the document using the DocumentViewer, this JSON can be loaded using the following JavaScript code:
var sAnnotations = "[[{\"pen\...}]]";
TXDocumentViewer.annotations.load(sAnnotations);
Live Demo
We added a new live demo to our online demo application that shows this in action. In this sample, the annotations are loaded separately into the viewer with a small delay:
Try this on your own by launching the online demos:
ASP.NET
Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.
- Angular
- Blazor
- React
- JavaScript
- ASP.NET MVC, ASP.NET Core, and WebForms
Related Posts
ASP.NETAnnotationsDocumentViewer
DocumentViewer: Aspect Ratio Scaling of Signature Annotations
In the latest version of the DocumentViewer, signature annotations can be scaled by keeping the aspect ratio. This article gives a quick overview of signature annotations and this new feature.
ASP.NETJavaScriptDocumentViewer
Using the MVC DocumentViewer in ASP.NET Web Forms
The ASP.NET MVC DocumentViewer for ASP.NET provides more features including document signing capabilities than the DocumentViewer for Web Forms. This article shows how to use the MVC…
Smart Documents: Embedding Documents in PDF Containers
TX Text Control is able to embed and extract embedded files to and from PDF documents. This can be used to create smart document containers that consists of the original document for editing and…
DocumentViewer Annotations: Highlight Text
We just published a pre-release version of the DocumentViewer that includes a new annotation feature: Text highlights. It is now possible to select text to add a comment at a specific text…
ASP.NETAnnotationsCollaboration
DocumentViewer Collaboration: Live Share Document Annotations
Digital collaboration became the norm in today's modern business world. Adding real-time document collaboration adds a significant value to applications to increase productivity for your users.…