Document Builder

Getting Started

The Document builder gives you all the necessary tools to help you build your document in a PDF format. You can include Document Headers, Text, Images, Tables, Page Breaks, etc.
Overview of Document Builder

Types of Merge Fields

Docupilot supports a variety of merge fields for you to use in your document builder.
  • Tokens (Merge Field)
  • Condition (if/else)
  • Loops
  • Tables
Docupilot supports easy ways to insert Merge fields into your document template. {{ }} button on the toolbar helps you insert the merge fields.

Tokens (Merge Field)

These are simple words embraced in {{}}. When you provide your custom data, Docupilot will replace these fields with the data. For example {{email}}, {{client_name}}, {{company_name}}.
If you want to group your fields you can use dot(.) while defining the tokens. For example if you want to capture your client's first name & last name, you can write the tokens as {{client.first_name}} and {{client.last_name}}

Condition (if/else)

You can use condition to show or hide contents based on your data. For example, if you are creating an invoice you want display PAID if the payment status field is paid, else you want to show UNPAID.
1
{{#if payment_status "==" "paid"}}
2
PAID
3
{{else if payment_status "==" "partial"}}
4
PARTIAL PAID
5
{{else}}
6
UNPAID, Insert Payment Instruction
7
{{/if}}
Copied!
You can use condition in three ways
  • if Statement.
  • if - else Statement.
  • if - else if - else Statement
Below are few examples :
Example
Description
{{#if payment_status}} {{/if}}
if payment_status is not empty or blank.
{{#if payment_status "==" "paid"}} {{/if}}
if payment_status equal to paid (case-sensitive).
{{#if payment_status "!=" "paid"}} {{/if}}
if payment_status not equal to paid (case-sensitive).
{{#if price ">" 1000}} {{/if}}
If price greater than 1000
{{#if price ">=" 1000}} {{/if}}
If price greater than and equal to 1000
{{#if price "<" 1000}} {{/if}}
If price lesser than 1000
{{#if price "<=" 1000}} {{/if}}
If price lesser than 1000
{{#if month "in" "January, February, March"}}
if month is either January or February or March

Hiding Empty Sections & Lines

You can use IF to hide sections/lines that do not have a value.
Hide section example
1
Name: {{name}}
2
{{#if address}}Address: {{address}}{{/if}}
Copied!
In the above example when the Address is empty, the Address section will be removed.
Hide empty lines example
1
{{name}}{{#if address}}
2
{{address}}{{/if}}
3
{{city}}{{country}}
Copied!
In the above example when the Address is empty, the Address empty line will be removed to achieve better document formatting.

Lists (Loops)

Lists are used when you want to print a list of items in your document. Docupilot supports three types of loops in document builder.
  • Simple List
  • Advanced List
  • Bulleted List
  • Numbered List

Simple Loop

1
{{#each items}}
2
{{this}}
3
{{/each}}
Copied!
Output
1
Apple
2
Orange
3
Strawberry
Copied!

Advanced Loop

You can use advanced loop, if you want to print list of items like line items. Think of this as a sub-form with multiple rows in your main form.
1
{{#each line_items}}
2
{{name}} ${{price}}
3
{{/each}}
Copied!
Output
1
Iphone6 $799
2
Iphone7 $899
3
Iphone8 $999
Copied!

Bulleted List

1
• {{#list services}}{{this}}{{/list}}
Copied!

Numbered List

1
1. {{#list services}}{{this}}{{/list}}
Copied!
Please use bullet insertion buttons from editor's tools pane for Bulleted and Numbered lists to work

Tables

A table is similar to an advanced list, but the data will be rendered in a table. For example, if you want to generate a invoice, you may want display a table with all the line items.
name
quantity
price
{{#each line_items }}
{{ name }}
{{ quantity }}
{{ price }}
{{/each}}

Hiding Empty Tables

You can use IF condition to hide empty tables, you should wrap the entire table inside a IF condition.
1
{{#if line_items}}
2
{{!...INSERT THE ABOVE TABLE IN THIS LINE...}}
3
{{/if}}
Copied!

Filtering rows in a Table based on empty column value

name
quantity
price
{{#each line_items }}{{#if quantity}}
{{ name }}
{{ quantity }}
{{ price }}
{{/if}}{{/each}}
If the value for quantity is empty in any row, it will be skipped in the output table.

Filtering rows in a Table based on a column value

name
quantity
price
{{#each line_items }}{{#if name "==" "Iphone"}}
{{ name }}
{{ quantity }}
{{ price }}
{{/if}}{{/each}}
If the value for name is Iphone in any row, it will be skipped in the output table.

Inserting a dynamic image

This will be helpful if you want to insert a dynamic image in the document.
Format : {{insert_image image1 width height}}
Order
Name
Description
Mandatory
1
width
Image width
Yes
2
height
Image height
No
Example
Description
{{insert_image image1 300 200}}
Image Width: 300px , Height: 200px
{{insert_image image1 300}}
The height is automatically adjusted to keep proportions
The image URL need to be publicly accessible so we can download and insert it in the document.

Inserting a QR Code

This will be helpful if you want to insert dynamic QR code from your data in the document.
Format: {{insert_qr url width margin}}
Order
Name
Description
Mandatory
1
width
QR Image width (px)
Yes
2
margin
No
Default: 4
Example: {{insert_qr url 100 1}}
100 X 100 with margin 1 & value https://docupilot.app
Example: {{insert_qr url 100}}
100 X 100 with default margin 4 & value https://docupilot.app/

Inserting a Barcode

This will be helpful if you want to insert barcode from your data in the document.
Format: {{insert_barcode name "barcode_format" width height margin "color" "bg_color" display_value=true/false}}
Order
Name
Description
Mandatory
Default Value
1
barcode_format
Barcode formats
CODE128
CODE39
No
CODE128
2
width
The width option is the width of a single bar.
No
2
3
height
The height of the barcode.
No
100
4
margin
Set the space margin around the barcode
No
10
4
color
Set the color of the bars and the text.
No
#000
5
bg_color
Set the background of the barcode.
No
#fff
6
label
Displaying the label below the barcode
No
true
Example: {{insert_barcode item_name}}
CODE128 Format
Example: {{insert_barcode name "CODE39"}}
CODE39 Format
Example: {{insert_barcode name "CODE128" 3}}
Example: {{insert_barcode name "CODE128" 2 25}}
Example: {{insert_barcode name "CODE128" 2 display_value= false}}

Inserting Google Maps

This will be helpful if you want to insert Google Maps from your data in the document.
Format: {{insert_map Address width height maptype}}
Order
Name
Description
Mandatory
Default Value
1
width
Width of the image (px)
Yes
2
height
Height of the image (px)
No
3
map type
Map types
roadmap
satellite
hybrid
terrain
No
roadmap
Example: {{insert_map Location 500 500 "roadmap"}}
Location Value is Manchester

Page Break

If you want to format your document into multiple pages properly, you can use the page break option. The content after the page break will begin in a new page.

Google Fonts

Docupilot supports all Google fonts to help you maintain your branding. Once you finish building your document, you will need to add a small code snippet by clicking on the source button in the document editor. You will need to change the font family accordingly to the choice of your fonts. You can find the font family here https://fonts.google.com/.
1
<style type="text/css">body{
2
font-family: 'Tangerine', serif;
3
}
4
</style>
Copied!
Google Fonts
Sometimes the document builder will not show the specified font but the document will be generated in the specified font.

Page Margins

Docupilot allows you to adjust the size of the top, bottom, left, right page margins in inches. You can set the margins in preferences -> More Options.
The default margin is 0.4 inches on all sides. You can also set it to zero.
Page Margins

Comments

You can add comments in the document template to help your future editors. The comments will be removed in the output document.
Comments Syntax : {{!Your comments here}}