Skip to content

Instantly share code, notes, and snippets.

@jakejackson1
Last active September 21, 2018 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakejackson1/4de8fffb77672868be29 to your computer and use it in GitHub Desktop.
Save jakejackson1/4de8fffb77672868be29 to your computer and use it in GitHub Desktop.
A sample PDF template showing off the pagebreak support
<?php
/**
* Template Name: Example Pagebreak
* Version: 0.1
* Description: A sample PDF template showing off the pagebreak support
* Author: Gravity PDF
* Group: Example
* License: GPLv2
* Required PDF Version: 4.0
*/
/* Prevent direct access to the template (always good to include this) */
if ( ! class_exists( 'GFForms' ) ) {
return;
}
?>
<style>
@page {
footer: html_pagenumbers;
}
@page rotated {
size: landscape;
}
@page a5{
sheet-size: 148mm 210mm;
footer: html_blank;
}
</style>
<htmlpagefooter name="pagenumbers">
<div style="text-align: center;">
{PAGENO}
</div>
</htmlpagefooter>
<!-- Empty footer so we can effectively turn footers off -->
<htmlpagefooter name="blank"></htmlpagefooter>
<p>My content here...</p>
<!-- Basic Page Break -->
<pagebreak/>
<p>This is on a new page</p>
<!-- Reset the page number back to 1 -->
<pagebreak resetpagenum="1"/>
<!-- Reset the page number to 5 -->
<pagebreak resetpagenum="5"/>
<!-- Page Break with page selector -->
<pagebreak page-selector="rotated"/>
<p>This is on a landscape page</p>
<!-- Page Break with different page selector -->
<pagebreak page-selector="a5"/>
<p>This is on A5 paper</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment