O'Reilly logo

iText in Action: Creating and Manipulating PDF by Bruno Lowagie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix E. Dealing with exceptions

The examples in this book are for demonstration purposes only. They’re conceived so that you can easily run them on your own computer, and I have tried to keep them as short as possible. Most of the time, the iText-related code is inside a try-catch sequence. In most cases, I print the stack trace to the System.out when something goes wrong. That’s OK for simple standalone applications; but in your own business applications, you should do something more intelligent in the catch clauses. Let’s look at what can go wrong when you’re producing a PDF document.

iText-specific exception classes

There are four important exception classes in iText, but you’ll probably never encounter two of them. PdfException and BadPdfFormatException ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required