PDF from Template

Last updated: November 6th 2023

You can pass your twig template along with all the possible variables you want to use into pdf content.

Basic Example
{% set settings = {
    filename: "My_PDF",
} %}

{% set vars = {
	entry : entry,
	data : data
} %}

{{ craft.superpdf.template("template/_pdf_template", settings, vars) }}
Basic Example to get PDF URL
{% set settings = {
    filename: "My_PDF",
    type: 'object'
} %}

{% set vars = {
	entry : entry,
	data : data
} %}

{% set object = craft.superpdf.template("_pdf_code", settings, vars) %}

// Printing object will return url by default.
PDF URL is: {{ object }}

// Object can be use to print different variables like this:
{{ object.filename }}
{{ object.kind }}
{{ object.size }}
{{ object.dateModified }}
{{ object.path }}
{{ object.url }}