Code Templates (HTML, CSS, Liquid)

Code templates give you full control over your documents with HTML, CSS and Liquid: dynamic data, page layout, fonts, snippets and fillable forms.

The Liquid Syntax

Introduction to Liquid, the templating language used in PDFMonkey code templates. Learn output tags, logic tags, objects, and filters for dynamic PDF content.

Using Dynamic Data

Define JSON test data in your PDFMonkey template to preview it live, reach nested values with dot notation in Liquid, and build variables with assign.

Formatting and Transforming Data

Liquid filters reference for PDFMonkey: format strings, numbers, dates and arrays, plus PDFMonkey filters for barcodes, Base64, currencies and more.

How to do Maths

Perform arithmetic in Liquid templates using PDFMonkey's math filters: plus, minus, times, divided_by, modulo, round, ceil, and floor with working examples.

Conditions and Loops for Code Templates

Use Liquid conditionals like if, else, unless, and case alongside for loops and tablerow tags to control what appears in your PDFMonkey template output.

Images and Links for Code Templates

Add images and clickable links to your PDFMonkey PDFs using external URLs, embedded images, inline SVG, or dynamic sources from your document data.

Image Resolution and File Weight

Why image-heavy PDFs are larger than expected and how to size images correctly for optimal file weight and print quality in PDFMonkey templates.

Page Size, Margins and Layout

Control page size, margins, single-page layouts, full-page backgrounds and page breaks in PDFMonkey code templates, with ready-to-copy CSS examples.

Using Web Fonts in Templates

Use Google Fonts, Font Awesome icons, custom typefaces and emojis in PDFMonkey templates, plus font inlining for reliable headers and footers.

Custom JavaScript

Add JavaScript to PDFMonkey code templates for dynamic calculations, Chart.js graphs, date formatting with Day.js, and DOM manipulation before rendering.

Custom CSS for Code Templates

Style PDFMonkey code templates with CSS: write your own styles, import external frameworks like Tailwind and add per-document styles from your data.

Using QR Codes for Code Templates

Generate QR codes in your PDF templates with PDFMonkey. Three JavaScript libraries compared — from fully customizable to quick and simple.

Header and Footer

Three approaches to adding headers and footers to your PDFs — from the built-in settings fields to in-content placement and the full-power Paged.js solution.

Reusing Template Code with Snippets and Partials

Avoid duplicated code in PDFMonkey templates: share code across templates with Snippets, or define reusable blocks inside one template with Partials.

Interactive PDF Forms (AcroForms)

Generate fillable PDF forms with PDFMonkey by adding markers to your templates: text fields, checkboxes, dropdowns, radio buttons, date pickers and more.

PDFMonkey Rendering Engines

PDFMonkey engine versions v2 through v5: Chrome versions, key capabilities, and what each engine supports for PDF rendering.

Professional PDF Template Creation Service

Let the PDFMonkey team design and code your templates. From 1,000 EUR, with pixel-perfect HTML/CSS, dynamic data wiring and review rounds.