Forum How do I...?

Flowing Text

BillSD
We do a lot of forms, and use Prince to generate PDFs.

There's one thing that we wish we could easily do, that Prince can't do at the moment.

Here's the use case. Let's say we have a user, that fills out information on the form. Most of the time, they don't write a lot of narrative, so it easily fits into the box provided in my layout. I tend to use tables when doing form PDFs, to make grid and rules cleaner.

The problem is when someone gets really verbose. When that happens either:

1) The cell grows to accommodate text (if allowed by CSS). If it's at the end of the document there's some extra fun where a run off the page of a table row causes the entire row to just flow off the page.

2) Or, if overflow is hidden it's just lost text.

So, we've tried a very complex script that count's the number of characters and fits what it can then splits it into another page. That has other issues because we can only approximate the number of characters that will fit because of learning and formatting. We also believe it tends to slow down production slightly because it's having to calculate while generating the PDF.

Column flowing works fine in newspaper and books, but not so much in very structured documents like forms. This tax forms, appraisals, or other government documents.

Ideally, what we would want to have is a way that we can designate some other div(s) to cascade to in the event of an overflow. Sort of the same thing you would expect in a page layout program like InDesign.

Maybe something where in a data attribute, you could designate a cascade to another element.

Is there a way to do this easily in PrinceXML?
mikeday
There isn't a mechanism for doing this yet. It would make sense to be able to capture overflow content and include it in a later block, but I do wonder whether that would be sufficient. Would it also be necessary to have conditional elements around that block depending on whether overflow content was captured?

For example if there was overflow content then you might want to place it on a new page with a heading, but you would not want that heading to be generated if there was no overflow content.
BillSD
I agree, that there are more features that would be required to make it more robust and more gracefully deal with overflows.

I guess I'm proposing is something like the CSS Regions specification specified by Adobe. It never got traction, and doesn't really make sense in a world where responsive design is the trend. It also makes sense that Adobe would propose something that would treat layout similar to a page layout program. Since this is for print and not viewing, we have the same challenges.

https://www.w3.org/TR/css-regions-1/

As to your other questions, yes, things like overflow suppression to not draw the DIV at all. In those circumstances Prince had always introduced PrinceXML specific CSS elements. Something like:

"prince-text-overflow-none: hidden;"

Or something if there is no overflow. I'm not sure about syntax, but I'm pretty sure you could outline the behaviors.