pdfMachine merge


Purchase Download Main pdfMachine merge page

Liquid Templating Language

pdfMachine merge supports full liquid template language in HTML templates and the email body, and also has partial support for liquid (liquid filters only) in Microsoft Word/Excel/PowerPoint document templates.

Liquid allows you to apply formatting, perform loops, conditionals etc based on the values from your datasource.
All the standard filters and tags are supported as mentioned here Liquid For Designers

e.g. to format a number merge field called "amount" as currency, you would do:

             {{ amount | money }}


Liquid Filters

Liquid contains filters which process the value of merge fields.
eg.
{{ name | capitalize }} which capitalize words in the input sentence.
{{ invoice_date | date : "d MMM yyyy" }} which formats dates according to csharp's powerful date formatting syntax see here

We have also added some custom filters (not part of Liquid specification) for dates, numbers and currency.

Date Formating

{{ datetimenow }} is a variable which is automatically set with the current time.
{{ datetimenow | dateplusdays : 30 | date : "d MMM yyyy" }} which takes the current time, adds 30 days and then outputs the formatted date.

Number Formating

{{ amt | number : "N2" }} which formats a number according to csharp's number formatting, both standard formats and custom formats.

{{ amt | number_culture : "C","ja-JP" }} which outputs the amount in yen.  This allows you to format any number including currencies in a format suited to a specified culture name from here

Currency Formating

{{ total_due | money }} which outputs the amount in your local currency format.  Same as calling {{ total_due | number : "C" }}
{{ total_due | money_no_cents }} which outputs the amount in your local currency format without cents.  Same as calling {{ total_due | number : "C0" }}

Looping and conditionals

Liquid also contains tags which support looping and conditionals
eg.
{% for desc in desc_array) %} html here {% endfor -%} which repeats the enclosed html for each of the elements of desc_array.  Note: Use forloop.index0 for the current index.
{% cycle 'rows':'LightGreyBackground', 'DarkGreyBackground' %} to alternate row colors in a table.

For an example of using the above in a template:
Click here to see an example HTML merge template using liquid.
Click here to see an example of the PDF generated.
When you install pdfMachine merge, a profile is setup with this demo invoice template, which you try out and customize to your requirements.

When using HTML templates, for best results you will need to set certain print options in Internet Explorer If you need help or more information on this feature please contact

Bundled Data

Bundled data is passed in as liquid arrays.
If there is a column in the data source called description, it is available as {{description}}
Where there is bundled rows (multiple rows with the same email address) in the data source, the multiple rows are passed in as an array in a variable called description_array.  This is accessed as {{ description_array[0] }}, {{ description_array[1] }} etc.