GlenKPeterson / PdfLayoutManager

Adds line-breaking, page-breaking, tables, and styles to PDFBox
45 stars 20 forks source link

Lacks option to set max height on cell #6

Closed tveimo closed 9 years ago

tveimo commented 9 years ago

It would be handy to be able to set maximum height for a cell.

GlenKPeterson commented 9 years ago

If you set the width and the height, what should happen if the text can't fit? Should it truncate the text? Should the text spill over into whatever's below (assuming vertical-align is top)? Should it spill over in other directions?

Or are you asking to set the height and let the text determine the width?

If you don't care about any of that, you might try just drawing lines in a box shape. Then stick a lone Cell with your text or images inside that box. It will be up to you to not overflow.

Another option is to make a table with a single row and single cell and set the minRowHeight. Then it's up to you to stick static content in there that does not overflow. The test has an example of that: https://github.com/GlenKPeterson/PdfLayoutManager/blob/master/src/test/java/TestPdfLayoutMgr.java#L93

The primary motivation for this project was to handle overflow by expanding cells vertically. If you don't need that, then just use PdfBox directly.

I hope that helps.

tveimo commented 9 years ago

My need was in order to limit the height of a block, anything overflowing would be hidden.

GlenKPeterson commented 9 years ago

I'll have to think about that. I can't make any guarantees since what you are asking for is outside the current scope of what PdfLayoutManager was intended to provide.

GlenKPeterson commented 9 years ago

Other people have asked your same two questions before (in person, on other forums, or here, but have since deleted them). I just added these questions plus some slightly better answers to a brand new Q&A section on the README.md / main page of this project. Thanks for your interest!

GlenKPeterson commented 9 years ago

I closed this as wontfix because I'm not convinced that a good universal cropping solution to this issue is possible or practical. Once again, I'm open to it, but not currently working toward it.