Server-side reporting
Generate a PDF from the template
Review the invoice in the editor, then send the current template to the server. The controller merges the nested JSON data and returns a PDF for download.
1Review the invoice template
Use the Reporting ribbon to inspect merge fields and repeating invoice rows before generating the output.
2Merge and download the PDF
The server applies the sample invoice data and returns the finished document as an Adobe PDF.
Server-side resultPDF download
The browser sends only the current template. The sample JSON is read and merged by the demo-specific controller.
Understand the current template
Explore its merge fields, repeating blocks, and nested structure in an interactive template map.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Merge using MailMerge
This sample separates document design from document generation: the browser provides the editable template, while the server owns the data source, merge operation, and PDF export.
Key members
Merge the invoice data
MailMerge.MergeJsonData
Export as PDF
ServerTextControl.Save
Send the template
TXTextControl.saveDocument
How it works
The browser saves the current template with TXTextControl.saveDocument and posts its internal document data to the demo-specific endpoint. The controller loads the template into a ServerTextControl, reads the first invoice from the nested JSON data, and calls MailMerge.MergeJsonData.
The merged document is exported with BinaryStreamType.AdobePDF and returned as Base64 for a browser download. The template inspector is available before merging so users can understand the fields and blocks they are about to process.
TXTextControl.saveDocument(
TXTextControl.StreamType.InternalUnicodeFormat,
event => fetch("/pdf", {
method: "POST",
body: JSON.stringify({ document: event.data })
}));
mailMerge.MergeJsonData(jsonData);
textControl.Save(out var pdf, BinaryStreamType.AdobePDF);
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0