Special Keywords
Templates in FastPDF use specific keywords to enable varied functionalities in document creation. This section explains the role of these special keywords in enhancing templates, headers, and footers. It covers the practical aspects of incorporating these keywords into your templates to meet different formatting and content requirements. Understanding these keywords will aid in customizing templates and automating parts of the document generation process.
Add a template from your dashboard.
Template Variables and Functions
- Name
document_page_break
- Type
- Description
Inserts a page break. Use this to start a new page in the PDF document.
Example usage:
{{ document_page_break }}
- Name
document_date
- Type
- Description
Displays the formatted date at the time of the document generation.
Example usage:
{{ document_date }}
- Name
signature_field
- Type
- Description
Inserts an EID-enabled signature field. Clicking this field in Adobe PDF Reader opens an invite for digital signature, compatible with EU ID cards and most digital certificates.
The field has a fixed size of 100pt x 40pt.
Example usage:
{{ docusignature_fieldent_date }}
- Name
image(uri)
- Type
- Description
Insert an HTML
<img>
tag with the image specified by theuri
argument. To add an image, visit your Dashboard.Example usage:
{{ image("my_image_uri1") }}
Alternatively, you can use the standard HTML syntax:
<img src="{{ my_image_uri1 }}">
- Name
barcode(value, ...)
- Type
- Description
Renders a barcode in the document. The
value
parameter is mandatory and specifies the data to encode. See below for optional arguments.barcode_type
: The type of barcode. Default is 'code128'. All available barcode types.render_options
: Additional formatting settings.x
andy
: Position of the barcode on the page (x, y coordinates).w
andh
: Width and height of the barcode.scale
: Scale factor for the barcode size. Default is 1.0.margin_left
andmargin_right
: Left and right margins. Default is 5.margin_top
andmargin_bottom
: Top and bottom margins. Default is 0.keep_ratio
: Whether to keep the aspect ratio. Default is True.text_enabled
: Whether to include text in the barcode. Default is True.
Example usage:
{{ barcode("1234123412", "qr", scale=0.5) }}
Header & Footer
Headers and footers comes with special variables that can be used to inject printing values into them.
- Name
document_date
- Type
- Description
Formatted date at the time of the document generation.
Example usage:
{{ document_date }}
- Name
document_title
- Type
- Description
Document title, set using html
title
tag.Example usage:
{{ document_title }}
- Name
document_page_number
- Type
- Description
Current page number.
Example usage:
{{ document_page_number }}
- Name
document_total_page
- Type
- Description
Total pages in the document.
Example usage:
{{ document_total_page }}