Craig, I remember from back when I was deep in the table layout code that elastic space in tables is extremely tricky (with our layout approach) which is why it's not available in tables today. In your case, it would actually be relatively easy since there is only one column, but it's still not available. So what you've done between tables is about as much as you can get right now.
The only work-around that I can come up with right now is not to put the ads in a table and generate only the initial header for each section. And then to try some post-processing magic with the area tree XML. Ugly but I don't see any other possibility right now. I've also tried inserting empty rows with elastic b-p-d but that didn't have any effect. At least that would provide a possibility of a reasonably easy fix for your situation because in rows like that, there's no "element list combination" (but only if there are no spans, i.e. the spacer table-row is a separate "row-group"). I guess it would still require quite an effort. Maybe someone else has a better idea. On 21.06.2010 18:47:51 Craig Ringer wrote: > Hi all > > I'm new to Apache FOP, and XSL-FO in general, so if this is a stupid > question please accept my apologies in advance. I've read the FAQ, > endless XSL-FO docs (including the ... dense ... spec), and searched the > list archives, so I'm not popping up without doing some research. > > The short version is that I can't figure out how to distribute vertical > space to avoid ragged column bottoms in multi-column pages when the flow > contains several long-ish one-column tables. Why one-column tables? > Because I have sections with headings that must be repeated at the top > of a column if split across columns. > > I'm writing a (to be open source) app to automatically paginate > classified ads to PDF, as I've been unable to find an acceptable > commercial solution at a reasonable price or locate any decent OSS > offering. I'm trying to use XSL-FO for layout, and need to produce > multi-column output, with column content flowing from bottom-left to > top-right along the columns. I'm using <fo:simple-page-master > column-count="7" ... /> to achieve that with no fuss. > > The content is blocks of text and graphics that either have large > widow/orphan limits or cannot be split across columns at all, so elastic > spacing is required to avoid huge ragged blobs of whitespace at the > bottom of columns. This is easy enough using elastic space-before[1] if > each ad is in its own <fo:block> that's directly flowed into the column. > > The tricky bit is that these collections of text blocks and images are > grouped into classifications, each of which must have a heading. If the > classification spans more than one column, **the heading must be > repeated at the top of the column**. I'm satisfying this requirement by > putting the ads in each classification into a one-column table and using > <fo:table-header/> to provide a repeating header. It's ugly, but it works. > > However, I can't figure out how to specify elastic spacing to distribute > space between rows in the table and between tables. Table rows don't > have a space-before attribute. Adding elastic space-before to the > <fo:block/> within each table cell appears to have no effect. And > there's no display-align="justify" that would spread spacing evenly > line-by-line within all objects [2], as would be ideal. I can specify > elastic space-before for each table as a whole, but to have much effect > I need so much space that large holes open up between tables, while the > rows within the tables remain cramped. > > (a) I need elastic spacing to prevent big, uneven chunks of whitespace > at the bottom of columns; but > > (b) I need to repeat classification headings at the top of columns, and > can only seem to do that with 1-column tables, the use of which seems to > prevent effective elastic spacing. > > > I've been trying to figure out a way to use the > block-progression-dimension attribute to achieve this, as it seems to be > a more generalized form of elastic sizing. However, I just can't figure > out how to use it to express a flexible "expansion" amount. To use it, I > seem to already have to know how big the block needs to be to hold its > contents, so I can set the minimum, optimum, and maximum appropriately. > > Is there any way to do this? Or am I barking up the wrong tree entirely? > > Is there a way to achieve repeating column headings that'll let me avoid > wrapping sections (classifications) up in one-column tables, so I can > use the usual elastic spacing mechanism? > > Is there any notional equivalent of display-align="justify" ? And if so, > any way to limit that justification or set a threshold of whitespace > percentage over which it won't try to do it? > > > Since I know how frustrating it is to see such questions without > concrete code: here's a sample XSL-FO document, generated from last > weeks' newspapers published classified ads: > > http://www.postnewspapers.com.au/~craig/fo_question/cl_pdf.fo > > and the PDF fop produces for it: > > http://www.postnewspapers.com.au/~craig/fo_question/cl_pdf.pdf > > The FO and PDF for another advertising section is also present, but is > less useful because it requires a huge bunch of referenced images to > paginate: > > http://www.postnewspapers.com.au/~craig/fo_question/tr_pdf.fo > http://www.postnewspapers.com.au/~craig/fo_question/tr_pdf.pdf > > ( In that directory there's also an XSLT transform (ads_to_fo.xml) and > the source xml (cl.xml and tr.xml), not that it's really relevant to the > question. ) > > > [1] > http://old.nabble.com/display-align%3D%22justify%22-ts8772141.html#a8772141 > > [2]http://article.gmane.org/gmane.text.xml.fop.user/25707 > > -- > Craig Ringer Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
