Skip to content
Ralf Stuckert edited this page Apr 26, 2016 · 7 revisions

PDFBox-Layout

column example

What is PDFBox-Layout

PDFBox-Layout is simple layout API on top of Apache PDFBox. PDFBox-Layout supports both PDFBox 1.8.x and 2.x. The key features are

  • word wrapping
  • text alignment
  • paragraphs
  • pagination

Why PDFBox-Layout?

PDFBox is very good in creating and parsing PDF content providing an API close to the PDF standard. But it lacks an API on top of that like organizing text in paragraphs, performing word wrapping and things like that. More than a decade ago I was using iText to create PDF documents from scratch, which was quite easy to use, and did all that stuff. But once upon a time Bruno Lowagie - the developer of iText - switched from open source to a proprietary license for reasons I do understand. So when I now had to do some PDF processing for a new project, I was looking for an alternative. PDFBox is definitely the best open source choice, but when I was searching on how to do layout, I found a lot of people looking for exactly those features, and the common answer was: you have to do it on your own. Ouch. Really? There must be some good soul out there, who already wrote that stuff... Maybe there is, but google does not know him. So I started to write some simple word wrapping. And some simple pagination. And some simple markup for easy highlighting with bold an italic. Don't get me wrong: this is neither sophisticated nor complete. It is drop dead simple, and does the things I needed. But just in case someone out there may find it useful, I made it public under MIT license.

Where to start?

The Getting Started page will explain the basic usage and the main feature. Also have a look at the examples and take them as start for your own usage scenarios.