Serving dynamic PDFs with iText

The Java world is good for “best-kept secrets”; and iText is one of the best. It’s a library that allows you to generate PDF documents on the fly. For example, you could use it to add PDF generation capabilities to your web applications.

Of course, there are other ways of generating PDFs from Java, but what makes iText stand out is its ease of use; the simplicity of its API. For example, adding a paragraph to a document is as simple as:

    document.open();
    document.add(new Paragraph("Hello World"));
    document.close();

By contrast, doing things with Jasper Reports (which uses iText) is just too much of a struggle, too buggy; it just hangs in an infinite loop too often.

When it comes to print-ready reports with all the control you could want, iText is definitely one to consider. It also has an active community, and is helped along by some excellent documentation.

About the Author

Matt Stephens is a senior architect, programmer and project leader based in Central London. He co-wrote Agile Development with ICONIX Process, Extreme Programming Refactored, and Use Case Driven Object Modeling with UML - Theory and Practice.

Featured

Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.