Table layout with divs

242 views
Skip to first unread message

RichD

unread,
Mar 19, 2012, 11:55:53 AM3/19/12
to Pisa XHTML2PDF Support
I posted a question recently about how to get the page to break in the
middle of a table row, instead of bumping the row to the next page.
I'm still interested in an answer to that question, but I thought I
would also try to approach my problem from the other end.

In xhtml2pdf, how would you get a tabular layout with divs? Here is
some sample markup. The source of the trouble is that my data in the
right column can be long paragraphs, so I want that content to flow
across pages. I'm wondering if that kind of table behavior can be
created with divs. Thanks.

<div class="row">
<div class="left_column">
This is my header.
</div>
<div class="right_column">
This is my data.
</div>
</div>

RichD

unread,
Mar 19, 2012, 12:17:04 PM3/19/12
to Pisa XHTML2PDF Support
I posted a question recently about having table row content flow
across pages, rather than starting the row at the top of the next
page. I would still like to know about an answer to that question,
but I thought I would also try to approach my problem from the other
end. Can you get a tabular layout with divs? I find that the float
attribute is not supported, as well as the display property table-
cell.

(Btw, I just tried to post this question a minute ago, but the content
of the post seems to have been immediately deleted. Maybe because I
included some sample html?)

Jonathan Kellenberg

unread,
Apr 30, 2012, 1:57:16 PM4/30/12
to xhtm...@googlegroups.com
According to the docs you cannot split table rows. Xhtml2pdf also doesn's support floating, so getting divs to float next to each other doesn't work either.

From the docs:

Long cells

Pisa is not able to split table cells that are larger than the available space. To work around it you may define what should happen in this case. The -pdf-keep-in-frame-mode can be one of: "error", "overflow", "shrink", "truncate", where "shrink" is the default value.

table {
-pdf-keep-in-frame-mode: shrink;
}

Position/ floating

Since Reportlab Toolkit does not yet support the use of images within paragraphs, images are always rendered in a seperate paragraph. Therefore floating is not available yet.

Reply all
Reply to author
Forward
0 new messages