Before we start: installing iText 7

All the examples explained in this tutorial are available on our web site from this URL:

Before we start using iText 7, we need to install the necessary iText jars. The best way to do this, is by importing the jars from the Central Maven Repository. We have made some simple videos explaining how to do this using different IDEs:

In these tutorials, we only define the kernel and the layout projects as dependencies. Maven also automatically imports the io jar because the kernel packages depend on the io packages.

This is the complete list of dependencies that you'll need to define if you want to run all the examples in this tutorial:

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.itextpdf</groupId>
  4. <artifactId>kernel</artifactId>
  5. <version>7.0.2</version>
  6. </dependency>
  7. <dependency>
  8. <groupId>com.itextpdf</groupId>
  9. <artifactId>io</artifactId>
  10. <version>7.0.2</version>
  11. </dependency>
  12. <dependency>
  13. <groupId>com.itextpdf</groupId>
  14. <artifactId>layout</artifactId>
  15. <version>7.0.2</version>
  16. </dependency>
  17. <dependency>
  18. <groupId>com.itextpdf</groupId>
  19. <artifactId>forms</artifactId>
  20. <version>7.0.2</version>
  21. </dependency>
  22. <dependency>
  23. <groupId>com.itextpdf</groupId>
  24. <artifactId>pdfa</artifactId>
  25. <version>7.0.2</version>
  26. </dependency>
  27. <dependency>
  28. <groupId>com.itextpdf</groupId>
  29. <artifactId>pdftest</artifactId>
  30. <version>7.0.2</version>
  31. </dependency>
  32. <dependency>
  33. <groupId>org.slf4j</groupId>
  34. <artifactId>slf4j-log4j12</artifactId>
  35. <version>1.7.18</version>
  36. </dependency>
  37. </dependencies>

Every dependency corresponds with a jar in Java and with a DLL in C#.

  • kernel and io: contain low-level functionality.

  • layout: contains high-level functionality.

  • forms: needed for all the AcroForm examples.

  • pdfa: needed for PDF/A-specific functionality.

  • pdftest: needed for the examples that are also a test.

In this tutorial, we won't use the following modules that are also available:

  • barcodes: use this if you want to create bar codes.

  • hyph: use this if you want text to be hyphenated.

  • font-asian: use this is you need CJK functionality (Chinese / Japanese / Korean)

  • sign: use this if you need support for digital signatures.

All the jars listed above are available under the AGPL license. Additional iText 7 functionality is available through add-ons, which are delivered as jars under a commercial license. If you want to use any of these add-ons, or if you want to use iText 7 with your proprietary code, you need to obtain a commercial license key for iText 7 (see the legal section of our web site).

You can import such a license key using the license-key module. You can get the license-key jar like this:

  1. <dependency>
  2. <groupId>com.itextpdf</groupId>
  3. <artifactId>itext-licensekey</artifactId>
  4. <version>2.0.3</version>
  5. </dependency>

Some functionality in iText is closed source. For instance, if you want to use PdfCalligraph, you need the typography module. This module won't work without an official license key.