Affects Version/s: 2.0.0
Fix Version/s: None
Michael Klink wrote this morning on stackoverflow on the topic about creating tables with PDFBox:
I'm afraid all those samples IMO meely are proofs of concept, probably of use in limited use cases but by far not for generic use. PDFBox has its strengths, e.g. a quite versatile content extraction framework and a content rendering capability, but the absence a proper layouting API is a serious weakness.
To which I answered:
I know... I just don't want to create another iText. We're not the Samwer brothers.
But he's right. We could of course look at what iText offers and implement that on our own, that wouldn't even be illegal, but it wouldn't be nice. I've never looked at or used iText, except once when answering this:
IMO what we need to start, is a method to write a paragraph to a PDF. Such a method would have these parameters:
- rectangle (or width and height from current position)
Such a method would then output the text and break the lines at the end of the rectangle, and throw an exception if the space isn't enough.
UPDATE: This will be implemented as an example, using either Java's built-in TextLayout or ICU4J.