Skip to content

Instantly share code, notes, and snippets.

@jakejackson1
Last active September 21, 2018 07:10
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/995559887bbad94b167f to your computer and use it in GitHub Desktop.
Save jakejackson1/995559887bbad94b167f to your computer and use it in GitHub Desktop.
A sample PDF template showing off the positioning support
<?php
/**
* Template Name: Example Positioning
* Version: 0.1
* Description: A sample PDF template showing off the positioning 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>
#autosize {
position: absolute;
top: 50mm;
left: 100mm;
font-size: 20pt;
width: 30mm;
height: 5mm;
overflow: visible;
}
#rotated {
position: absolute;
top: 50mm;
left: 100mm;
width: 30mm;
height: 40mm;
background: grey;
rotate: -90;
}
</style>
<div style="position: absolute; top: 0; left: 0">I'm outside the page margins</div>
<div style="position: absolute; top: 0; right: 0">I'm outside the page margins</div>
<div style="position: absolute; bottom: 0; left: 0">I'm outside the page margins</div>
<div style="position: absolute; bottom: 0; right: 0">I'm outside the page margins</div>
<pagebreak/>
<div style="position: fixed; top: 0; left: 0">I'm inside the page margins</div>
<div style="position: fixed; top: 0; right: 0">I'm inside the page margins</div>
<div style="position: fixed; bottom: 0; left: 0">I'm inside the page margins</div>
<div style="position: fixed; bottom: 0; right: 0">I'm inside the page margins</div>
<pagebreak/>
<div id="rotated">Rotated</div>
<pagebreak/>
<div id="autosize">My Very Long Text Too Big For Container</div>
<pagebreak/>
<div id="autosize" style="overflow: auto">My Very Long Text Too Big For Container</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment