wkhtmltopdf - Coldfusion 11 CFHTMLTOPDF adding page break between 2 divs with position:relative -
i trying create pdf cfhtmltopdf contains 2 rows of divs have css setting of position:relative; . between each row want have page break create <cfhtmltopdfitem type="pagebreak" />.
this creates page break , adds second row second page, second row still included on first page (so duplicated). if remove position:relative fixes issue breaks formatting.
i have tried wrapping code in div or table doesn't contain position:relative; have found if content (divs,tables) has object relative position same issue occurs. have work around this? example code below.
<cfhtmltopdf orientation="landscape"> <!doctype html> <head> <title>test page</title> <style> .block{width: 288px; height: 255px; margin: 0 0 10px 8px;position:relative;padding: 0; display:inline-block; top: 0; left:0; vertical-align:top;background: #cee7f4;color: #0081c6;} .block2{width: 288px; height: 255px; margin: 0 0 10px 8px;padding: 0; top: 0; left:0; vertical-align:top;background: #cee7f4;color: #0081c6;display:inline-block;} </style> </head> <body> <div style="position:static;display:block;border:1px solid green;">test1 <div class="block"> block 1 </div> <div class="block"> block 2 </div> </div> <cfhtmltopdfitem type="pagebreak" /> <div style="position:static;display:block;border:1px solid red;">test 2 <div class="block"> block 3 </div> <div class="block"> block 4 </div> </div> <cfhtmltopdfitem type="pagebreak" /> <div>this code works</div> <div class="block2"> block 5 </div> <div class="block2"> block 6 </div> <cfhtmltopdfitem type="pagebreak" /> <div class="block2"> block 7 </div> <div class="block2"> block 8 </div> </body> </html> </cfhtmltopdf>
I have ran into this same issue where removing a text-overflow rule fixed the issue. However, I have a table needing text-overflow: hidden. Resulted in having to count rows of the table and manually insert a block level div to push following content to next page. :-( This duplicating of info using page breaks has been a HUGE pain.
ReplyDelete