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 ...

Get iText in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.