One of the major applications for Text Control digital document processing components is the creation and processing of invoices and other document types.

Documents can be send as attachments in e-mails, a link can be provided to view the documents online or access to a document portal can be granted. By providing users a streamlined way to access documents, you gain additional advantages such as document tracking. You receive the ability to know when an document has been opened and accessed.

Hybrid: Combining Offline and Online

Over the next couple years, there might be still a requirement to send out printed documents. Whether this is required for legal reasons or a customer request to receive printed versions of documents. By providing a combination of both offline and online, users are getting best of both worlds and can adjust to the electronic deployment strategies.

The easiest way to achieve this is to provide users access to all their documents in a portal. On the printed version, simply place a QR code that opens the document directly in your portal using the Text Control DocumentViewer.

TX Text Control QR Codes

With TX Text Control, creating QR codes is an integrated feature and is as simple as merging text into merge field placeholders. QR codes can be used as placeholders in reporting templates. Each barcode object is assigned a unique ID and Name in order to visualize actual data during the merge process.

Sample Application

For demo purposes, a very simple dummy document can be generated in the demo portal by clicking the button Create Dummy Document:

TX Text Control QR Codes

The requested Company Name is only used to generate a document from a template that contains some form fields to demonstrate that the documents are dynamically created. When clicking Create, the data is merged into the template and a unique ID is generated. This unique ID is added to an URL that opens the stored document in another view whenever this QR code is scanned. This URL is merged into the QR Code placeholder field.

[HttpPost]
public bool CreateDummyDocument(string CompanyName) {
// create a unique ID
string guid = Guid.NewGuid().ToString();
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) {
// create ServerTextControl and load template
tx.Create();
tx.Load("App_Data/vendor.tx", TXTextControl.StreamType.InternalUnicodeFormat);
using (TXTextControl.DocumentServer.MailMerge mailMerge = new TXTextControl.DocumentServer.MailMerge()) {
mailMerge.TextComponent = tx;
// flatten PDF
mailMerge.FormFieldMergeType = TXTextControl.DocumentServer.FormFieldMergeType.Replace;
// create dummy merge data with barcode URL
VendorData data = new VendorData() {
vendor_name = CompanyName,
document_qr = Url.Action("View", "Home", new { id = guid }, protocol: Request.Scheme)
};
// merge template
mailMerge.MergeObject(data);
}
// save results and store in database
byte[] results;
tx.Save(out results, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
using (MemoryStream ms = new MemoryStream(results)) {
using (var db = new LiteDatabase("App_Data/MyData.db")) {
var col = db.GetCollection<Document>("documents");
var document = new Document {
Name = "dummy_" + guid + ".tx",
DocumentId = guid,
Created = DateTime.Now
};
col.Insert(document);
var fs = db.FileStorage;
fs.Upload("$/documents/" + "dummy_" + guid + ".tx", "dummy_" + guid + ".tx", ms);
}
}
return true;
}
}
view raw test.cs hosted with ❤ by GitHub

The document is stored in a database and the overview lists all stored documents:

TX Text Control QR Codes

When the QR code is scanned, a URL is opened that loads the requested document by the given ID into the DocumentViewer:

TX Text Control QR Codes

The view is using the DocumentViewer to render the document that is loaded from the database:

TX Text Control QR Codes

public IActionResult View(string id) {
// retrieve document by id and return document as model
using (var db = new LiteDatabase("App_Data/MyData.db")) {
var fs = db.FileStorage;
using (MemoryStream ms = new MemoryStream()) {
fs.Download("$/documents/dummy_" + id + ".tx", ms);
var fileBytes = ms.ToArray();
ViewDocument viewDoc = new ViewDocument() {
Name = "dummy" + id + ".tx",
BinaryData = Convert.ToBase64String(fileBytes)
};
return View(viewDoc);
}
}
}
view raw test.cs hosted with ❤ by GitHub

You can test this on your own by downloading the sample application from our GitHub repository.

Conclusion

Using Text Control digital document processing components, you get a complete set of tools to fully integrate invoice processing and deployment strategies into your business applications. Talk to our engineers, if you would like to learn more about how Text Control can help you with your document processing requirements.