PDF from HTML

Last updated: March 7th 2020

You can turn up your HTML variable into pdf. All you have to do is to set the variable and pass to Super PDF.

Basic Example
{% set html %}
	<h1>This is a basic example</h1>
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.</p>
{% endset %}

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

{{ craft.superpdf.html(html, settings) }}
Basic Example to get PDF URL
{% set html %}
	<h1>This is a basic example</h1>
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.</p>
{% endset %}

{% set settings = {
    filename: "My_PDF",
    type: 'url'
} %}

{% set url = craft.superpdf.html(html, settings) %}

PDF URL is: {{ url }}