How to install prerequisites for PDF generation support
MIDAS v4.32 introduces support for generating PDF files. This allows, for example, invoices to be sent to clients via email as PDF attachments rather than "inline" in the body of emails.
In order to enable these features, customers running self-hosted editions of MIDAS v4.32+ will need to first ensure that their servers are configured to support PDF generation.
In summary, PDF generation in MIDAS v4.32 requires two additional components to be installed on your server:
- "wkhtmltopdf" - an open source command line tool to render HTML into PDF format.
- The "PDF::WebKit" Perl Module - which allows Perl (the language MIDAS is coded in) to communicate with "wkhtmltopdf".
The following article outlines how to install and configure these components for use with your self-hosted MIDAS system.
Step 1: Install "wkhtmltopdf"
Obtain the latest version of "wkhtmltopdf" from the official website via this link. It's available for free and is supported on all major server operating systems, including Windows and Linux-based servers.
For Windows based operating systems, a standard Windows installer is available for both 32 and 64 bit architectures. Simply download the appropriate installer to your server and run to install "wkhtmltopdf".
For Linux-based operating systems, install the appropriate package on your server as you would other packages.
The example instructions below are for installing "wkhtmltopdf" on a CentOS 7 server:
- From a bash command prompt, use "wget" to download the the latest "wkhhtmltopdf" RPM to your server (at time of writing this is 0.12.6)# wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
- Install the downloaded RPM from bash:# sudo yum install wkhtmltox-0.12.6-1.centos7.x86_64.rpm
You may be prompted to install dependencies, press "y" to install any additional dependencies as required.
- Once installed, find the install location by issuing the following command via bash:# which wkhtmltopdf
This will return a location such as:
/usr/local/bin/wkhtmltopdfYou'll need to make a note of this location, as you'll need it when configuring your MIDAS system to use wkhtmltopdf.
Step 2: Install PDF::WebKit
For assistance installing additional Perl modules, please see our How to install Perl modules article.
Step 3: Configure MIDAS
Once you've successfully installed both "wkhtmltopdf" and "PDF::WebKit" on the server from which your MIDAS system runs, you'll lastly need to let MIDAS know where it can find the "wkhtmltopdf" program on your server.
Login to your MIDAS system as an administrator, and go to MIDAS Admin Options → Manage MIDAS → Miscellaneous → PDF Generation.
Enter the server path to where "wkhtmltopdf" has been installed in the "Location of wkhtmltopdf" field.
For Windows based servers, you'll also need to append the "wkhtmltopdf.exe" executable to this location. Typically, this will be "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" on 64 bit Windows servers.
Click the "Save Changes" button to save your settings.
Your MIDAS system is then configured for PDF generation.
To enable invoices to be sent via email as PDF attachments, enable the "Send invoices as PDF attachments" setting, which may be found via MIDAS Admin Options → Manage MIDAS → Email → Advanced.
← Return to the Knowledge Base