Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating Page-Breaks In CFDocument Without Using CFDocumentItem In Lucee CFML 5.3.7.47
<style type="text/css">
div.start-on-new-page {
page-break-before: always ;
}
</style>
<cfdocument
format="pdf"
filename="./document.pdf"
overwrite="true">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>
CFDocument: Generating Page-Breaks Without CFDocumentItem
</title>
<!---
Even though we aren't using CFDocumentItem[type=pagebreak], the CFDocument
tag can generate page-breaks using the CSS property: "page-break-before".
If we add this at the start of a "section", that section will begin on a
new page of the PDF.
--->
<style type="text/css">
div.start-on-new-page {
page-break-before: always ;
}
</style>
</head>
<body id="pageOne">
<h1>
CFDocument: Generating Page-Breaks Without CFDocumentItem
</h1>
<ul>
<li>
<a href="#pageTwo">Page Two</a>
</li>
<li>
<a href="#pageThree">Page Three</a>
</li>
</ul>
<div id="pageTwo" class="start-on-new-page">
<h2>
Page Two
</h2>
<p>
I am page two, woot woot!
Continue on to <a href="#pageThree">Page Three</a>.
</p>
</div>
<div id="pageThree" class="start-on-new-page">
<h2>
Page Three
</h2>
<p>
I am page three, tee hee hee!
Jump back up to <a href="#pageOne">the top</a>.
</p>
</div>
</body>
</html>
</cfdocument>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment