Version: 3
🔥 Gravity PDF v3 end of life was 2017-06-20 and this version is no longer supported. This legacy documentation is kept for reference only.
Example of Adding Custom Page Sizes to PDF Templates
Change Document Size
The plugin ships with a number of PDF templates showing off the features of mPDF. These can be found in your PDF_EXTENDED_TEMPLATES directory.Overview
Template Name:example-different-page-size_08.php
Example URL: https://test.com/?gf_pdf=1&fid=3&lid=40&template=example-different-page-size_08.php
mPDF allows the document size and layout to be changes on a per-page basis, giving you finite control over the output of your PDF document.
Pagebreaks can be controlled using the <pagebreak>
tag or via Named @page
elements. However the simplest technique is to use the <pagebreak>
tag.
Example
<!-- set the next page to A6 -->
<pagebreak sheet-size="A6" />
<!-- set the next page using a custom size -->
<pagebreak sheet-size="70mm 150mm" />
<!-- set the next page to landscape -->
<pagebreak orientation="landscape" />
<!-- combine the sheet size and orientation -->
<pagebreak sheet-size="A4" orientation="landscape" />
While the examples are basic, the <pagebreak>
element attributes can be complex so we advise you read the mPDF documentation before using it.