LogoLogo
HomePricingSign inRegister
  • PDFMonkey Documentation
  • Guides
    • From zero to generating your first Document
    • Generating your first Document with Zapier
    • Generating your first Document with Make
    • Making your first API call
  • PDFMonkey Features
    • 14-day Pro trial
    • Automatic deletion (TTL)
    • CLI
    • Generating images
    • Share links
    • Synchronous generation
    • Snippets
    • Webhooks
  • Frequent questions
    • Troubleshooting
      • My Document is blank
      • My data is not showing up in the Document
      • The Download URL is empty
    • What can you do with PDFMonkey?
    • What happens if I use all of my quota?
    • How do I change my password?
    • How do I delete my account?
    • Authoring Templates
      • Can I import an existing PDF or Word file in PDFMonkey?
      • What are the Template test data?
      • Can you create templates for me?
      • Can I display the number of the current page in the content?
      • Can I use links?
    • Privacy and security
      • What data do you keep and for how long?
      • How is my data secured?
      • Do you have a DPA
    • Compliance
  • How-tos
    • Adding a header or footer to your document
    • Including images in your documents
    • Styling your documents
      • Writing your own CSS
      • Using external libraries
      • Providing per-Document styles
      • Dealing with page breaks
    • Using different fonts
      • Handling special characters (UTF-8, Hebrew, Chinese, etc)
      • Using different fonts in header and footer
    • Using JavaScript
      • What are the available JavaScript features
      • JavaScript and Dynamic Data
      • Using external libraries
      • Displaying dates and time using JS
      • Including charts in your Documents
      • Debugging your JavaScript
    • Setting the filename of the generated Document
    • Changing the size of the page and its margins
    • Forcing a single page or use a full-page background
    • Using QR Codes
  • Integrations
    • List of integrations
    • Zapier
      • Generating your first Document with Zapier
      • Document generation options in Zapier
      • Reacting to generated documents in Zapier
      • TODO Retrieving a Document in Zapier
      • TODO Deleting a document using Zapier
      • Fixing frequent Zapier errors
    • Make (formerly Integromat)
      • Generating your first Document with Make
    • Workato
      • Generating a document with Workato
      • Deleting a document using Workato
      • Reacting to generated documents in Workato
    • Glide
    • Bubble
    • InvoiceBerry (via Zapier)
    • Ruby SDK
  • References
    • The Document Lifecycle
    • Liquid Reference
      • Introduction
      • Defining and using dynamic data
      • Variables
      • Naming variables
      • Conditions (if/else)
      • Iteration (dealing with lists)
      • Filters (data transformation)
        • Built-in filters
        • PDFMonkey filters
      • PDFMonkey Liquid tags
      • Whitespace control
    • API Reference
      • Documents
      • Templates
Powered by GitBook
On this page
  • append
  • date
  • default
  • divided_by
  • minus
  • newline_to_br
  • plus
  • times
  • where

Was this helpful?

  1. References
  2. Liquid Reference
  3. Filters (data transformation)

Built-in filters

PreviousFilters (data transformation)NextPDFMonkey filters

Last updated 3 years ago

Was this helpful?

We will list the most useful filters here. You can find the complete list of filters in .

append

Adds the specified string to the end of another string.

Input
{{"/my/fancy/url" | append: ".html"}}
Output
/my/fancy/url.html

date

Converts a timestamp into another date format. The format for this syntax is the same as . The input uses the same format as Ruby’s .

Input
{{article.published_at | date: "%a, %b %d, %y"}}
Output
Fri, Jul 17, 22
Input
{{article.published_at | date: "%Y"}}
Output
2022

date works on strings if they contain well-formatted dates

Input
{{"March 14, 2022" | date: "%b %d, %y"}}
Output
Mar 14, 22

To get the current time, pass the special word "now" (or "today") to date.

Input
Last update: {{"now" | date: "%Y-%m-%d %H:%M"}}
Output
Last update: 2022-03-14 12:34

Need a timezone?

default

Sets a default value for any variable with no assigned value. default will show its value if the input is nil, false, or empty.

In this example, product_price is not defined, so the default value is used.

Input
{{product_price | default: 2.99}}
Output
2.99

In this example, product_price is defined, so the default value is not used.

Input
{% assign product_price = 4.99 %}
{{product_price | default: 2.99}}
Output
4.99

In this example, product_price is empty, so the default value is used.

Input
{% assign product_price = "" %}
{{product_price | default: 2.99}}
Ouput
2.99

divided_by

Divides a number by another number.

Input
{{16 | divided_by: 4}}
{{5 | divided_by: 3}}
Output
4
1

Rounded result

The result is rounded down to the nearest integer (that is, the floor) if the divisor is an integer.

minus

Subtracts a number from another number.

Input
{{4 | minus: 2}}
{{16 | minus: 4}}
{{183.357 | minus: 12}}
Output
2
12
171.357

newline_to_br

Inserts an HTML line break (<br />) in front of each newline () in a string.

Input
{{"Hello\nWorld" | newline_to_br}}
Hello<br />
World

plus

Adds a number to another number.

Input
{{4 | plus: 2}}
{{16 | plus: 4}}
{{183.357 | plus: 12}}
6
20
195.357

times

Multiplies a number by another number.

Input
{{3 | times: 2}}
{{24 | times: 7}}
{{183.357 | times: 12}}
Output
6
168
2200.284

where

In this example, assume you have a list of products and you want to show your kitchen products separately. Using where, you can create an array containing only the products that have a "type" of "kitchen".

Input
All products:
{% for product in products %}
- {{ product.title }}
{% endfor %}

{% assign kitchen_products = products | where: "type", "kitchen" %}

Kitchen products:
{% for product in kitchen_products %}
- {{ product.title }}
{% endfor %}
Output
All products:
- Vacuum
- Spatula
- Television
- Garlic press

Kitchen products:
- Spatula
- Garlic press

Take a look at the in_time_zone filter .

Creates an array including only the objects with a given property value, or any value by default.

the official Liquid documentation
Read the complete append documentation.
Read the complete date documentation.
strftime
Time.parse
Read the complete default documentation.
Read the complete divided_by documentation.
Read the complete minus documentation.
Read the complete newline_to_br documentation.
Read the complete plus documentation.
Read the complete times documentation.
Read the complete where documentation.
truthy
provided by PDFMonkey