Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Liquid does not create a PDF by itself. It binds data, evaluates conditions, loops through records, applies filters, and produces HTML. A PDF renderer then converts that HTML into a paginated PDF. Reliable output therefore requires three compatible pieces: a well-defined data model, a Liquid dialect supported by your renderer, and print CSS that the renderer can actually interpret.

How Liquid fits into PDF generation

The usual pipeline is:

  1. Validate invoice, report, certificate, or other document data.
  2. Render a Liquid template against that data.
  3. Send the resulting HTML to a PDF engine.
  4. Inspect the generated PDF for pagination, fonts, images, headers, footers, and metadata.

Liquid is a template language created by Shopify. Its job is data binding and control flow, not page layout. The downstream renderer determines paper size, page breaks, CSS coverage, font embedding, image loading, and whether attached PDFs retain your document header or footer.

The three Liquid building blocks

Construct Syntax Use in a PDF template
Objects and variables {{ invoice.number }} Print a value into the HTML output.
Tags {% if invoice.paid %}...{% endif %} Conditions, loops, assignments, and template composition.
Filters {{ total | round: 2 }} Transform a value before printing; filters can be chained from left to right.

Whitespace and escaping behavior can differ between implementations. Treat the syntax table as the common core, then verify every feature against the PDF product or library you selected.

Objects and paths

Objects can be strings, numbers, booleans, nil, arrays, or implementation-specific empty values such as EmptyDrop. Dot notation reads nested properties: invoice.customer.name. A missing value commonly becomes nil, which is false in a condition, but a renderer may warn, silently print nothing, or fail in strict mode.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Tags for decisions and iteration

Use if/elsif/else for status-dependent sections and for for line items. Keep business calculations in your application where possible; use Liquid for presentation decisions and simple transformations.

Filters for presentation

Filters can format dates, round numbers, change case, escape text, or convert line breaks. Filter names are not universal. A filter documented by Shopify may be absent or renamed by a PDF service, so test it in the target dialect rather than assuming compatibility.

A complete invoice HTML/Liquid template

The following template demonstrates output, conditional status, a line-item loop, rounding, and conservative HTML suitable for a PDF renderer. Replace the sample context with your application data.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Invoice {{ invoice.number }}</title>
    <style>
      @page { size: A4; margin: 18mm 14mm 20mm; }
      body { font-family: Arial, sans-serif; color: #222; font-size: 12px; }
      h1 { margin: 0 0 6px; font-size: 24px; }
      .muted { color: #666; }
      table { width: 100%; border-collapse: collapse; margin-top: 18px; }
      th, td { border-bottom: 1px solid #ddd; padding: 7px 5px; text-align: left; }
      .number { text-align: right; white-space: nowrap; }
      .totals { width: 46%; margin-left: auto; }
      .status { font-weight: bold; }
      tr { page-break-inside: avoid; }
    </style>
  </head>
  <body>
    <header>
      <h1>Invoice {{ invoice.number }}</h1>
      <p class="muted">Issued {{ invoice.issued_at }}</p>
      {% if invoice.paid %}
        <p class="status">Paid</p>
      {% else %}
        <p class="status">Due {{ invoice.due_at }}</p>
      {% endif %}
    </header>

    <section>
      <h2>Bill to</h2>
      <p>{{ invoice.customer.name }}<br>
         {{ invoice.customer.address }}</p>
    </section>

    <table>
      <thead>
        <tr><th>Description</th><th class="number">Amount</th></tr>
      </thead>
      <tbody>
        {% for line in invoice.lines %}
          <tr>
            <td>{{ line.description }}</td>
            <td class="number">{{ line.amount | round: 2 }}</td>
          </tr>
        {% endfor %}
      </tbody>
    </table>

    <table class="totals">
      <tr><td>Subtotal</td><td class="number">{{ invoice.subtotal | round: 2 }}</td></tr>
      <tr><td>Tax</td><td class="number">{{ invoice.tax | round: 2 }}</td></tr>
      <tr><th>Total</th><th class="number">{{ invoice.total | round: 2 }}</th></tr>
    </table>

    {% if invoice.notes %}
      <section><h2>Notes</h2><p>{{ invoice.notes }}</p></section>
    {% endif %}
  </body>
</html>

The data supplied to this template should contain invoice.number, dates, customer fields, a lines array, numeric totals, and a boolean paid value. Calculate authoritative totals before rendering; do not rely on independently rounded line values to reconstruct an accounting total.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Missing values, empty arrays, and safe output

Set a contract for required fields

Define a versioned schema for every document type. Decide which fields are mandatory, which have defaults, and which may be omitted. Validate that contract before invoking Liquid. In production, enable strict or warning handling for undefined variables and filters when the implementation supports it, and fail the job when a required field is absent instead of silently issuing an incomplete document.

Guard optional sections

Use an explicit condition around optional notes, discounts, shipping blocks, or tax registrations. Check that a line-item array is present and non-empty before emitting a table. Since nil is false in Liquid conditions, a simple guard often works, but empty-array semantics vary enough that a real test case should be included in your renderer’s test suite.

Escape untrusted text

Customer names, addresses, notes, and imported descriptions should be escaped unless your policy intentionally permits HTML. Decide separately whether a field is plain text or trusted markup. Never treat customer-editable Liquid as an opportunity to execute server code. Shopify’s reference implementation is non-evaluating: parsing and compilation are separated from rendering so templates receive data rather than arbitrary Ruby execution.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Reusable headers, footers, and line-item partials

Large documents become easier to maintain when repeated markup is moved into snippets. Where supported, use render with explicit parameters:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{% render "header", invoice: invoice %}
{% render "line-item", line: line %}
{% render "footer", invoice: invoice %}

Named parameters make dependencies visible. Shopify documents with and for forms as well, while marking the older include form deprecated in favor of render. Rendered snippets normally have isolated scope, so pass every value they need explicitly. A service that does not implement render may require a different include mechanism; do not copy snippets between products without checking this behavior.

Formatting dates, money, and line breaks

Keep currency arithmetic, tax rules, and rounding policy in application code. Liquid should format already validated values. A typical expression is {{ total | round: 2 }}; date formatting and line-break conversion are also common, but their exact filter names and accepted formats are renderer-specific. Record the locale, currency, timezone, and rounding mode alongside the document data so a rerun produces the same result.

Filters run left to right. For example, a renderer that supports both operations may evaluate {{ customer.name | escape | upcase }} by escaping first and changing case second. If a filter is unavailable, strict mode should expose the failure during testing rather than allowing a production PDF to contain an empty value.

What the PDF renderer controls

CSS and pagination

Use print-oriented CSS and conservative layout primitives. Set an explicit page size and margins with @page, avoid layout features unsupported by your engine, and use page-break-inside: avoid on rows or cards that must stay together. A browser preview is not proof that the PDF engine will paginate identically.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fonts and images

Make font files and images reachable by the renderer, not only by your local browser. Check embedding, fallback fonts, image dimensions, and whether remote URLs require authentication. Missing fonts can change line wrapping and move a totals block onto a new page.

Headers, footers, and merged PDFs

Header and footer support is an engine feature, not a Liquid feature. Some systems apply them through special PDF options rather than ordinary HTML. Current RMS documents a specific limitation: PDFs attached and merged during generation may not include the document-layout header or footer. If your workflow merges attachments, inspect the merged result instead of assuming the template header survives.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Liquid dialects and portability

There is no single universal PDF Liquid runtime. Shopify and Jekyll expose different extensions, and managed services may ship older or customized versions. PDFMonkey states that its templates currently use Liquid v4, so features marked 5.0.0 or newer in the official reference are unavailable there. A self-hosted Liquid library, LiquidJS, Shopify-compatible engine, and a vendor’s custom implementation can therefore disagree on:

  • Supported tags, filters, operators, and object access.
  • Whitespace-control syntax and escaping defaults.
  • render, include, and snippet scope.
  • Undefined-variable behavior and strict-mode errors.
  • HTML, CSS, font, image, and page-break support downstream.

Before migrating, build a compatibility fixture containing every tag and filter your templates use. Record the Liquid version, renderer version, template revision, input-data revision, and output checksum so a document can be reproduced during an audit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Self-hosted library or managed PDF service?

Decision axis Self-hosted Liquid plus PDF engine Managed PDF service
Dialect control You choose the library and can pin versions, but must maintain compatibility. The vendor controls the dialect; confirm version and custom filters before migration.
Rendering operations You operate browsers or another PDF engine, fonts, images, queues, retries, and storage. The service usually supplies the rendering infrastructure; verify latency, retention, and retry behavior.
Security model You control template access, sandboxing, secrets, and network egress. You must understand how customer-edited templates and submitted data are isolated.
Portability Portable only when your HTML/CSS and Liquid subset are conservative. Convenient, but custom filters and proprietary APIs can create lock-in.
Auditability Log template, data, engine, and renderer versions yourself. Confirm what versions and job artifacts the provider records.

Vortex PDF describes the managed sequence directly: the API processes the template, injects context data, and renders the resulting HTML into a PDF. That model is convenient, but it does not remove the need to validate data, CSS, fonts, pagination, and dialect behavior.

Production implementation checklist

  1. Write and version the input schema for each document.
  2. Validate required fields and totals before rendering.
  3. Keep Liquid focused on binding, conditions, loops, and presentation filters.
  4. Escape untrusted text and explicitly identify any trusted HTML fields.
  5. Use reusable render snippets with explicit parameters where supported.
  6. Pin and document the Liquid dialect, filter set, and PDF engine.
  7. Generate fixtures for missing fields, empty lines, long descriptions, large tables, non-Latin text, and image failures.
  8. Render with strict or warning errors enabled during CI and production where available.
  9. Inspect the actual PDF for page breaks, fonts, images, headers, footers, metadata, and merged attachments.
  10. Store template, renderer, data, and output versions for reproducibility.

Troubleshooting Liquid PDF failures

“It works in preview but the PDF is blank”

The preview may be evaluating JavaScript or loading resources that the PDF worker cannot reach. Confirm that the renderer receives the same context, that remote images and fonts are accessible, and that the HTML response is non-empty before conversion.

A variable prints nothing or causes an error

Check spelling and nesting, then determine whether the field is absent, nil, or an unsupported object type. Enable strict undefined-variable handling if available, add a schema validation step, and provide an explicit default only when an absent value is genuinely acceptable.

A filter is unknown

Verify the target Liquid version and vendor-specific filter list. Replace nonportable filters with application-side formatting or a supported equivalent, and add the expression to your compatibility fixture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rows split across pages

Apply conservative table markup and page-break-inside: avoid to rows where supported. Extremely tall rows cannot always be kept intact; allow a controlled split or redesign the content. Test with realistic long descriptions, not only short sample data.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Fonts or logos disappear

Use absolute, renderer-reachable URLs or bundled assets, check authentication requirements, and inspect the PDF’s embedded fonts. A fallback font can alter line lengths enough to change pagination.

Headers or footers vanish after merging

Check the merge stage independently. Some systems do not carry document-layout headers and footers into attached PDFs, so apply the header/footer after merging or use the engine’s supported repeated-header mechanism.

The output changes between runs

Look for current timestamps, locale-dependent formatting, unordered data, remote assets, or an unpinned renderer version. Supply timezone and locale explicitly, sort arrays before rendering, pin dependencies, and retain the exact input and template used for each job.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your application already exposes the rendered invoice or report as a URL, ScreenshotNeo can capture that page without you operating a browser worker. Before capture it accepts the consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing result. It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Use the documented request format at https://screenshotneo.com/docs/, substituting the URL of your own rendered document endpoint:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your-site.example/invoices/123 -o invoice.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://your-site.example/invoices/123"}, timeout=90)
open("invoice.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://your-site.example/invoices/123' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo supports PNG, JPEG, WebP, and PDF capture, plus full-page capture, custom CSS and JavaScript, waiting for a selector or network idle, custom headers and cookies, signed links, asynchronous jobs, bulk capture, and an API usage endpoint. Every feature is on every plan: 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.

FAQ

Can Liquid add page numbers?

Not by itself. Page numbering requires a feature of the PDF renderer, such as generated-content support or a header/footer option. Confirm the syntax and limitations of your chosen engine.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should totals be calculated in Liquid?

Use application code for authoritative arithmetic, tax rules, currency conversion, and rounding policy. Liquid can display and format the resulting values.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Is a Liquid template the same as a PDF template?

A Liquid template is the data-and-markup stage. A PDF template usually refers to that stage plus the renderer settings, print CSS, fonts, assets, and page-layout rules needed to produce a PDF.

How can I make a document reproducible?

Persist the input data, template revision, Liquid dialect and version, PDF-engine version, locale, timezone, and asset versions with the generated file.

Frequently Asked Questions

Can Liquid add page numbers?

Not by itself. Page numbering requires a feature of the PDF renderer, such as generated-content support or a header/footer option. Confirm the syntax and limitations of your chosen engine.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should totals be calculated in Liquid?

Use application code for authoritative arithmetic, tax rules, currency conversion, and rounding policy. Liquid can display and format the resulting values.

Is a Liquid template the same as a PDF template?

A Liquid template is the data-and-markup stage. A PDF template usually refers to that stage plus the renderer settings, print CSS, fonts, assets, and page-layout rules needed to produce a PDF.

How can I make a document reproducible?

Persist the input data, template revision, Liquid dialect and version, PDF-engine version, locale, timezone, and asset versions with the generated file.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.