How to handle dompdf Two Column Design?
i want to use dompdf to create html to pdf. I have an design with two columns. Every column could be higher than a normal dina4 page. So i have a page-break.
I dont want to use float, because dompdf float is buggy sometimes and i dont want to float something, i want two fix containers (left, right).
If i use position:absolute; this container cant make a page-break. With position:fixed; this container is on every dina4 site (nice for footer and header, bad for my solution).
If i use a t开发者_如何学Cable with two columns to design it, dompdf can not handle table in table and i get an error message. But i have to use a table for my content.
Are there any other Solutions for this Problem? postion:absolute with a correct page break or something else?
EDIT:
My Page: div header (position: fixed;) div footer (position: fixed;) div content (2 column design - left & right with page breaks)
Best Regards
You could use position relative & position absolute with left margins. This works on a single page so should work over more than one page.
<div style="clear:both; position:relative;">
<div style="position:absolute; left:0pt; width:192pt;">
LEFT COLUMN
</div>
<div style="margin-left:200pt;">
RIGHT COLUMN
</div>
</div>
I've ran in to this problem before, (column layout split over more than one page), and with DomPdf the easiest way to get column layouts is to use tables to set out the page, and to do some kind of calc on when to create new rows and columns. This did work for me, but it's not an ideal solution, as you end up having to create a whole new layout plus complicated logic for the pdf.
If I had to do this again, I'd look at http://code.google.com/p/wkhtmltopdf/ which is highly recommended. There's a PHP extension for it... https://github.com/mreiferson/php-wkhtmltox
Here's a review... http://ciaranmcnulty.com/blog/2009/04/converting-html-to-pdf-using-wkhtmltopdf
Please let me know how you get on with this.
Good luck :)
You can use:
display:inline-block;
精彩评论