Home / Articles / Tools of the Trade, Part 1: Creating PDF documents with iText

Tools of the Trade, Part 1: Creating PDF documents with iText

Contents

  1. Create PDF Documents with iText
  2. iText Intro
  3. Class Tour
  4. Planetary PDF
  5. Conclusion

Article Description

Have you ever wanted to create your own PDF documents without having to first shell out money for PDF-creation software? Good news: You can create those documents with nothing more than Java and iText. This freely available Java library provides the classes for easily constructing PDF documents and adding various kinds of content (such as paragraphs, lists, tables, and images) to those documents. This article by Jeff Friesen, the first in a three-part series that explores useful open-source tools, introduces you to iText and shows you how to create many interesting PDF documents without having to first spend money on PDF-creation software.

The successful Java developer requires extensive and accurate knowledge of the language and its APIs. A toolbox full of useful tools that help the developer solve problems in an efficient manner also contributes to success.

I have found three very useful open-source tools that have helped me with my Java career. Because I enjoy working with these tools and because I think they will also benefit your own Java career, I wrote this three-part series to introduce each tool. This article launches that series by focusing on iText.

Create PDF Documents with iText

Have you ever wanted to create Adobe PDF documents without having to spend money on PDF-creation software? (You can create five free PDF documents at Adobe's Web site, but you must pay a subscription fee to create documents beyond the first five.) Thanks to Java and a utility called iText, you can create PDF documents for free. iText even lets you create HTML, RTF, and XML documents (also for free).

This article introduces you to iText from the perspective of PDF-document creation. After showing you how to acquire iText, establish an appropriate directory structure, and set the CLASSPATH environment variable, I present a simple Java application that uses iText to create an elementary PDF document. The article then takes you on a tour of iText classes that you will frequently access from your Java applications, along with several small Java applications that demonstrate class usage. To show how iText helps you with big PDF projects, the article concludes by showing you how to create a multichapter PDF document on the solar system's planets. That project's more extensive Java application references several of the classes that were explored in the tour and reveals how iText capabilities combine to create a significant PDF document.

2. iText Intro | Next Section