Re: Wide Table - Horizontal Page Break

621 views
Skip to first unread message

BrianS

unread,
Aug 22, 2012, 10:15:16 AM8/22/12
to dom...@googlegroups.com
Unfortunately, dompdf is not currently able to split wide content across pages. Certainly I can see this as being useful (and preferable, for some content). But for now we're still working on improving height-based paging.


On Tuesday, August 21, 2012 11:53:31 AM UTC-4, John Helmuth wrote:
I have a web page that displays a report in a table with a large, variable number of columns for which I am adding a PDF output option.  The number of columns varies depending on the report options (date range) selected; the number is the same all through the table on any given run of the report.

The users of this page all have wide-screen monitors and have no problem looking at the page in their browsers.  

When I convert the html of the page to PDF via dompdf, it works perfectly when rendering 14 or fewer columns, properly breaking on the appropriate <TR> to the next page and repeating the <THEAD> section as expected.

Unfortunately, when there are more than 14 columns, the PDF chops off the columns past the right edge of the page, i.e. in the middle of the 15th column.

I have worked around the issue with an ugly hack (you don't want to know), but it occurred to me that dompdf might have an option I missed to split wide tables onto additional pages, similar to how it splits tall tables across multiple pages.

I have several other reports that are similar to this one (in that they have many columns) to which I need to add a PDF output option; I don't really want to repeat my ugly hack on each one of them.


John Bell

unread,
Aug 23, 2012, 7:36:36 AM8/23/12
to dom...@googlegroups.com
Haven't tried it, but one hack that comes to mind is to display the table twice; once normally and second time with a negative value for the left position equal to a page width, alternatively use a larger page width (possibly landscape orientation)

John
--
You received this message because you are subscribed to the Google Groups "dompdf" group.
To view this discussion on the web visit https://groups.google.com/d/msg/dompdf/-/Rr4nlb3dixQJ.
To post to this group, send email to dom...@googlegroups.com.
To unsubscribe from this group, send email to dompdf+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dompdf?hl=en.

Fabien Ménager

unread,
Aug 26, 2012, 10:25:10 AM8/26/12
to dom...@googlegroups.com
I didn't find a CSS specification for this. Prince XML has a proprietary property for this kind of problem, but it's not perfect.
John solution may be a good solution, but I don't know the complexity.

John Helmuth

unread,
Aug 30, 2012, 10:22:15 AM8/30/12
to dom...@googlegroups.com
Brian, John: Thank you for your replies.  

The solution John posted is similar to what I finally rolled out... I render the table multiple times and hiding the columns (using display: none;) for the columns I did not want to see on each "horizontal" page.

The first column in the table contains labels for each row, which I wanted to repeat on each page, so shifting the tables off the page wouldn't have shown those columns.

To implement this, I needed to alter my HTML template to identify each column's TD cell with a css class that identifies the column and the "horizontal" page.  My script renders a separate CSS sheet for the dompdf input that uses these classes in the selectors to hide the columns.

This, to my mind, is not ideal, as the table is re-rendered for each page, which takes longer, and uses more memory; but is currently working.

--jdh

BrianS

unread,
Sep 4, 2012, 11:18:06 AM9/4/12
to dom...@googlegroups.com
Nothing specific. The closest thing I could find is a list of recommendations for content outside the page box. I think that, perhaps, for a future release we can investigate ways to handle this.
Reply all
Reply to author
Forward
0 new messages