Getting started with iText 7 Java

iText 7 is available under two licenses:

Click the arrow to expand information about our libraries.

Download instructions are identical for both, and fully explained below.


Compatibility Matrix



7.0.0 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.0.6 7.0.7 7.1.0 7.1.1 7.1.2
pdfSweep 1.0.0 1.0.1 1.0.1 1.0.1-1.0.2 1.0.2 1.1.0 1.1.0 1.1.1 2.0.0+ 2.0.0+ 2.0.1+
pdfInvoice 1.0.0 1.0.1+ 1.0.1+ 1.0.1+ 1.0.1+ 1.0.1+ 1.0.1+ 1.0.1+ 2.0.0+ 2.0.0+ 2.0.0+
pdfDebug - 1.0.1 1.0.1 1.0.1 1.0.1 1.0.1 1.0.1 1.0.1 2.0.0+ 2.0.0+ 2.0.0+
pdfCalligraph 1.0.0 1.0.1 1.0.2 1.0.2-1.0.3 1.0.3 1.0.3 1.0.3 1.0.3 2.0.0+ 2.0.0+ 2.0.0+
pdfXFA 1.0.0+ 1.0.0+ 1.0.0+ 1.0.0+ 1.0.0+ 1.0.0+ 1.0.0+ 1.0.0+ 2.0.0+ 2.0.0+ 2.0.0+
pdfHTML - - 1.0.0 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 2.0.0+ 2.0.1+ 2.0.2+
pdf2Data - - - 1.0.8-1.1.3 1.0.8-1.1.3 1.0.8-1.1.3 1.0.8-1.1.3 1.0.8-1.1.3 2.0.0+ 2.0.0+ 2.0.1+


How to download iText 7 Community and the open source add-ons?

Automated dependency management for iText 7 Community Java

If you're using Maven as your build tool for Java, add the following XML snippet to your pom.xml. You will always need kernel, io and layout. If you do not require some of the functionality in iText 7 Community, then you can add only the modules you need.

<dependencies>

    <!-- always needed -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>kernel</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- always needed -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>io</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- always needed -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>layout</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- only needed for forms -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>forms</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- only needed for PDF/A -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>pdfa</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- only needed for digital signatures -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>sign</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- only needed for barcodes -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>barcodes</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- only needed for Asian fonts -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>font-asian</artifactId>
        <version>${itext.version}</version>
    </dependency>

    <!-- only needed for hyphenation -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>hyph</artifactId>
        <version>${itext.version}</version>
    </dependency>

</dependencies>

If you need all iText 7 Community modules, then you don't need to add the individual modules and you can just add this in your pom.xml. Maven will then do all the heavy lifting for you and download the required modules from The Central Repository.

<dependencies>

    <!-- add all iText 7 Community modules -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itext7-core</artifactId>
        <version>${itext.version}</version>
        <type>pom</type>
    </dependency>

</dependencies>

iText 7 Community Java on GitHub

The source code is available on GitHub.


How to download iText 7 Core and add-ons?

License key and library

If you've purchased a commercial license for iText 7 and/or its add-ons, you have a license key. To properly use it, that means you're going to have to download the proper license key library. Read more about the license key libaries. An FAQ about the license key can be found here.

Using The Central Repository

iText 7 Core for Java is available via Maven on The Central Repository.

For the add-ons, please be aware only the open source add-ons (pdfHTML, pdfSweep, pdfInvoice and pdfDebug) can be downloaded from the Central Maven Repository. The closed source add-ons can only be downloaded from the iText servers (see below).

Simply add iText 7 Core as a dependency to your pom.xml:

<dependencies>

    <!-- add all iText 7 Core modules -->
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itext7-core</artifactId>
        <version>${itext.version}</version>
        <type>pom</type>
    </dependency>

</dependencies>

Using the iText Artifactory Server

Because the add-ons pdfCalligraph, pdfXFA and pdf2Data, and the license key library are closed source, they are not available on The Central Repository. You can get them from the iText Artifactory server instead. iText 7 Core is also available there.

You can add this server as an additional Maven repository in the repositories section of your pom.xml or settings.xml, as described in the Maven documentation. Maven will then automatically query this repository for the add-on .jar files.

You can also browse the iText Artifactory server and download jars manually.

1. Add repository to .pom project file

<!-- All add-ons and iText 7 core-->
<repositories>
  <repository>
    <id>itext</id>
    <name>iText Repository - releases</name>
    <url>https://repo.itextsupport.com/releases</url>
  </repository>
</repositories>

<!-- pdf2Data-->
<repository>
  <releases>
    <enabled>true</enabled>
  </releases>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <id>pdf2data-releases</id>
  <name>iText pdf2Data Repository - releases</name>
  <url>https://repo.itextsupport.com/pdf2data</url>
</repository>

2. Add the dependencies to .pom project file:

<dependencies>

  <!-- pdfSweep -->
  <dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>cleanup</artifactId>
    <version>${itext.pdfsweep.version}</version>
  </dependency>

  <!-- pdfCalligraph -->
  <dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>typography</artifactId>
    <version>${itext.pdfcalligraph.version}</version>
  </dependency>

  <!-- pdfInvoice -->
  <dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>zugferd</artifactId>
    <version>${itext.pfdinvoice.version}</version>
  </dependency>

  <!-- pdfHTML -->
  <dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>html2pdf</artifactId>
    <version>${itext.pdfhtml.version}</version>
  </dependency>

  <!-- pdfXFA -->
  <dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>pdfxfa</artifactId>
    <version>${itext.pdfxfa.version}</version>
  </dependency>

  <!-- pdf2Data -->
<dependency>
  <groupId>com.duallab.pdf2data</groupId>
  <artifactId>pdf2data</artifactId>
  <version>${project.version}</version>
</dependency>

</dependencies>

Please be aware that for pdf2Data next to the SDK (described above), you also need to install the pdf2Data template editor (web application) - installation instructions can be found here.


License key libraries

The licensekey library (itext-licensekey-x.y.z.jar) needs to be on the classpath. It can be downloaded from our repository.
NOTE:

  • Please use the latest version of the license key library when using your license key. The latest version is 3.0.0. For iText 5, please use version 1.

  • With the introduction of version 3.0.0 of the license key library, we also released a volume based counting mechanism. The mechanism works with an event system. iText and its add-ons will send events through this event system. When a volume license key file has been loaded, the statistics concerning usage will be sent to our servers. This means the machine that runs your application needs an active Internet connection. Click here to read our guid showing you how to enable the automated monitoring of volume licenses (Capacity Rental License).

You can also use Maven to resolve this dependency. To do so, add the iText Artifactory server, https://repo.itextsupport.com/releases, as an additional repository in the repositories section of your pom.xml, as described in the Maven documentation. Then you can add the following dependency to your dependencies:

<dependencies>
  <!-- iText 7 License Key Library -->
  <dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>itext-licensekey</artifactId>
    <version>${itext.licensekey.version}</version>
  </dependency>
</dependencies>

The license file (typically itextkey.xml) needs to be loaded before calling the proprietary code. This is done using the static method loadLicenseFile() of the LicenseKey class: LicenseKey.loadLicenseFile("path/to/itextkey.xml") You can also use this method with an InputStream to the license file.


How to uninstall iText 7 Community or Core?

Java version - Maven


To install iText 7 follow below steps:

  1. Take the iText code out of your project.
  2. Run the Maven command mvn dependency:purge-local-repository -DreResolve=false.
  3. Take the iText dependencies out of your pom.xml.
Reference: http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html