Skip to content

Instantly share code, notes, and snippets.

@jakejackson1 jakejackson1/example-pagebreak.php Secret
Last active Sep 21, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.