Automated Word Document and PDF Generation
Creating Word and PDF documents for clients and other business associates is a critical aspect of many businesses. Whether it be a quote for a prospective customer, a service agreement, a client record or even a purchase order, the process of generating and updating these documents can be a time consuming and error prone exercise.
A Common Problem
It is common for a business to maintain a number of Word document templates that need to be manually adjusted each time a document needs to be created and sent out. In the case of a purchase order, the business may have already entered the purchase details into their internal systems. When the time comes for creating the purchase order as a PDF document, these details are then transcribed into the Word document template and then adjusted accordingly to suit each individual case before exporting to a PDF document.
Wouldn’t it be great if this could be automated?
A Common Solution
Many businesses have realised the potential to improve the efficiency of generating PDF documents by incorporating software to automatically populate their document templates. Quite often though, this process involved converting existing Word document templates into HTML and CSS templates so that the software can produce a document with the desired layout.
These HTML templates were traditionally converted to PDF using two popular open source tools.
1. wkhtmltopdf – a command line tool that ran on Windows, MacOS and Linux specifically created to render HTML to PDF.
These tools were effective for the most part however had the downsides of lacking support of modern HTML and CSS features. As a result, compromises had to be made on the layout and there were quite often differences in how the PDF rendered when compared to viewing it in a modern web browser.
A more recent development was the introduction of a ‘headless’ mode to Google Chrome itself. This provided the ability to use a fully functioning modern web browser without a graphical user interface to programmatically render the HTML template as a PDF document. This meant the developer was able to utilise the latest HTML and CSS features as well as achieving visual consistency between the PDF document and in a web browser. The downside was that a version of Google Chrome needed to be installed on your servers to be used by your applications.
While utilising these solutions have enabled the business to successfully automate the process of generating PDF documents, they have introduced a new ongoing cost. Whenever the layout or text in the template needs to be altered, a software developer with expertise in HTML and CSS is required to make the necessary changes. This has a flow on effect of increased lead time before the new template is available for use.
The Ideal Solution
The preferred approach is to utilise the business’ existing Word document templates and populate them directly without the need for HTML/CSS conversion. Having the ability to use the intuitive features of Microsoft Word including tables, fonts, bullet points, images, headers and footers and column layouts means that how you see your document presented in Microsoft Word is how you will see it in the generated PDF.
Within the Word document template, mail merge fields are placed where dynamic personalised data should be populated. These fields are not just limited to text but can also be used for images and can also be part of conditional expressions. An example of using conditional expressions might be that you want to test if a value is empty and show the text ‘no data available’ instead of an empty value or maybe translate the values ‘Y/N’ to ‘Yes/No’.
No longer are compromises needed to be made due to possible limitations or rendering issues with HTML/CSS. It also enables anyone to adjust the layout or change the text in the template without the need for a software developer to intervene. Simply opening the template with Microsoft Word, making the necessary adjustments are saving those changes is all that is required. The process is streamlined, and results are instantaneous.
If you would like to learn more about automating the creation of Word documents and PDF documents, contact the team at Qubisoft. We have successfully helped multiple businesses with their document conversion endeavours.