Guide
Generating a PDF
Basic Usage
Printmaker provides methods to create a new PDF file from HTML or template source.
These methods will return a PdfModel object, which allows you to edit, output, download, save, or send the generated PDF via your template.
You can supply HTML code directly using the pdfFromHtml
method, or generate a PDF from a compiled template using the pdfFromTemplate
method.
printmaker.pdfFromHtml
The pdfFromHtml()
method accepts two parameters:
- html (required) — the HTML which will be used to generate the PDF
- settings (optional) — any custom settings for the PDF engine
|
printmaker.pdfFromTemplate
The pdfFromTemplate()
method accepts three parameters:
- a template (required) — the path/name of the Twig template, just like you’d use in an
{% include %}
tag - variables (optional) — an object containing any variables you want to pass to the template for use in rendering its content
- settings (optional) — any custom settings for the PDF engine
|
Caught a mistake or want to contribute to the documentation?
Submit a PR via Github
or
email Support.