0

I'm finally dumping iText for PDFBox. The requirements for the document to be created are trivial. With iText I've been using something like

for (Foo foo : foos) {
  document.add(new Paragraph(foo.getName()));
}

What is the PDFBox equivalent to that? Their Hello World example doesn't really give a clue.

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198

1 Answers1

1

PDFBox doesn't have a high level API for generating blocks of text (yet). There are some articles such as How can I create fixed-width paragraphs with PDFbox? How to generate multiple lines in PDF using Apache pdfbox

In addition there are projects such as https://github.com/dhorions/boxable who add table formatting to PDFBox.

Community
  • 1
  • 1
Maruan Sahyoun
  • 569
  • 3
  • 6
  • Thanks, I was aware of all of them before I placed my question (SO suggests them). However, since those answers go a few years back I thought things might have changed for the better in the meantime. Sigh... – Marcel Stör Apr 27 '16 at 19:16
  • 1
    @MarcelStör Adding layout'ing capabilities has been discussed by PDFBox committers, e.g. [here](https://issues.apache.org/jira/browse/PDFBOX-2618) on their Jira; unfortunately the opinion prevails that any less-than-perfect layouter is even less desirable than no layouter at all. – mkl Apr 28 '16 at 12:49