Convert HTML Email into PDF

What the Rule Does

The rule creates PDF files from incoming messages using the original email content, saves PDF files to a local folder and sends an email with the PDF attachment to a recipient. You can activate/de-activate the “Send Email” component depending on your needs.

If you do not have G-Lock Email Processor yet, click here to download it now.

How to Use the Rule

1. Download PhantomJS.

To be able to process email messages by this rule, you need to download PhantomJS (free open source tool).

At this page, you can download PhantomJS for Windows.

Extract the content from the downloaded file to the root folder on the C: drive for example.

Now open the examples folder on C:\phantomjs-2.1.1\, copy the rasterize.js file and paste it into the bin folder (C:\phantomjs-2.1.1\bin).

2. Download Rule.

Click here to download the rule (.zip file).

Extract the rule .txt file and .eml file.

Open G-Lock Email Processor and click on “Open Rules folder”.

Copy-paste the rule PhantomJS.txt file to the Rules folder.

Copy-paste the .eml file to the Emails folder.

Return to G-Lock Email Processor and click on “Reload Rules Folder”.

Look for the “PhantomJS” rule in the list of rules. Click on the rule name to see what components it includes.

Important notes:

The path to the default folder to save PDF files is D:\111\. If you want to change the folder to save PDF files, you can change it in the PdfFolder extractor settings.

Convert HTML Email into PDF

If you change the path to the folder in the PdfFolder extractor, make sure to change it in the Folder extractor settings after file:/// too.

Leave file:/// in place.

Convert HTML Email into PDF

Important! By default, the path to the phantomjs.exe file is C:\phantomjs-2.1.1-windows\bin\. In our rule, the path is phantomjs-2.1.1\bin\ because we renamed the phantomjs-2.1.1-windows folder to phantomjs-2.1.1. To avoid errors during the rule execution, open the PhantomPath extractor settings and type the correct path to your phantomjs.exe file.

Convert HTML Email into PDF

If the path to the phantomjs.exe file is wrong, the rule execution fails with the error below:

Convert HTML Email into PDF

You can also check and activate the Send Email rule if needed. It sends an email with the created PDF file as an attachment. You can check the path to the attachment under the Advanced tab.

Download the Rule (.zip file).