How can I prevent page-break in CFDocument from occuring in middle of content?
Posted
by
Dan Roberts
on Stack Overflow
See other posts from Stack Overflow
or by Dan Roberts
Published on 2009-03-17T15:03:49Z
Indexed on
2014/05/28
3:27 UTC
Read the original article
Hit count: 191
I am generating a PDF file dynamically from html/css using the cfdocument tag. There are blocks of content that I don't want to span multiple pages.
After some searching I found that the style "page-break-inside" is supported according to the docs. However in my testing the declaration "page-break-inside: avoid" does no good.
Any suggestions on getting this style declaration to work, or have alternative suggestions?
Here is an example. I would expect the content in the div tag not to span a page break but it does. The style "page-break-inside: avoid" is not being honored.
<cfdocument format="flashpaper">
<cfloop from="1" to="10" index="i">
<div style="page-break-inside: avoid">
<h1>Table Label</h1>
<table>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
<tr><td>label</td><td>data</td></tr>
</table>
</div>
</cfloop>
</cfdocument>
© Stack Overflow or respective owner