Before we start: installing iText Core
All the examples explained in this tutorial are available on our web site from this URL: Examples for the iText jump-start tutorial
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:
How to import iText 7 in Eclipse to create a Hello World PDF?
How to import iText 7 in Netbeans to create a Hello World PDF?
How to import iText 7 in IntelliJ IDEA to create a Hello World PDF?
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:
<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>7.0.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>io</artifactId>
<version>7.0.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>7.0.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>forms</artifactId>
<version>7.0.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>pdfa</artifactId>
<version>7.0.4</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>pdftest</artifactId>
<version>7.0.4</version>
</dependency>
</dependencies>
Every dependency corresponds with a jar in Java and with a DLL in C#.
kernel
andio
: 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. In order to be able to download this JAR file, you'll need to add a repository to your repositories node in the pom file. This is necessary because the license key repository is closed source, and therefore not available on Maven Central.
<repositories>
<repository>
<id>itext</id>
<name>iText Repository - releases</name>
<url>https://repo.itextsupport.com/releases</url>
</repository>
</repositories>
You can get the license-key jar by adding a dependency like this:
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext-licensekey</artifactId>
<version>2.0.4</version>
</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.