How to Get Started with iText 8: A Beginner’s Guide to Library and API Usage

iText is a highly versatile and robust library used for creating and manipulating PDF files in Java. It is capable of generating high-quality documents with complex layouts and rich multimedia content.

The ease of embedding text, images, tables, and interactive forms in PDFs make it a go-to library for developers dealing with document-intensive applications. It is programmatically accessible, providing developers with complete control over the PDF creation and manipulation process.

Another significant feature of iText is its ability to handle advanced PDF features such as watermarks, encryption, and Digital Rights Management (DRM), which make it a great tool for more complex and advanced projects. It also provides a mechanism to create bookmarks, annotations, and comments, making it easier to navigate through voluminous PDFs.

iText is a powerful library that allows developers to generate and manipulate PDF files in Java. To get started with iText 8 in your Java project, follow these steps:

In your Maven pom.xml file, add the following dependency:


Maven Central

Once you have added the iText dependency to your project, you can start using it to create PDFs. Here’s a simple example code that creates a PDF file and adds a paragraph to it:

package org.kodejava.itext;

import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Paragraph;


public class CreatePDFIntro {
    public static void main(String[] args) {
        try {
            PdfWriter writer = new PdfWriter("HelloWorld.pdf");
            PdfDocument pdf = new PdfDocument(writer);
            Document document = new Document(pdf);
            document.add(new Paragraph("Hello World!"));
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);

This code will create a file named HelloWorld.pdf in the root folder of your project, containing a single paragraph with the text “Hello, World!”.

iText offers a multitude of features, from basic ones such as adding text and images to a PDF, to more complex ones like adding bookmarks, watermarks, and securing the PDF. The official iText 8 documentation is a comprehensive resource that covers these features in great detail; it also has several examples that show how to use the library.

In addition, iText provides strong international language support. This includes various fonts and writing systems, including every Western, Middle Eastern, and Asian language.

It’s worth noting that iText prioritizes performance and memory management, which is especially advantageous when dealing with large quantities of data or high-demand environments.

Given its wide range of features and powerful capabilities, iText is a time-tested choice for generating and manipulating PDFs in Java-centric software development. However, careful attention must be given to its licensing. The open-source version of iText is offered under AGPL, which can be restrictive for some projects. Therefore, for commercial use, a commercial license is recommended.

Introduction to JetBrains IntelliJ IDEA Community Edition

In this post I will introduce to you the JetBrains IntelliJ IDEA, one the most powerful IDE (Integrated Development Environment) for Java development or other languages that run on the JVM such as Groovy and Scala. IntelliJ IDEA comes in two editions, the IntelliJJ IDEA Ultimate Edition and the IntelliJ IDEA Community Edition.

The IntelliJ IDEA Community Edition is an open source version of Intelli IDEA. That’s mean you can use it for free. If you work with standard Java, Groovy, Scala or mobile development using Android then the Community Edition can be your choice. If you work with in web or Java EE development then the Ultimate Edition is the way to go.

Here are some features that you will get when using the IntelliJ IDEA Community Edition:

  • An Intelligent code editor that has all the smarts for understanding Java, XML and Groovy code.
  • Refactorings, code inspections and intentions, super-fast navigation and search
  • Testing framework integration: JUnit and TestNG
  • Build tools support: Ant and Maven
  • Popular version control systems integration: CVS, Subversion and Git
  • Swing UI designer

After a bit of introduction, let’s begin the installation.

Step 1. Getting the Installation Distribution

  • Download the installation package of the IntelliJ IDEA Community Edition.
  • Click Download IntelliJ IDEA Community Edition to go the download page.
  • On the page you can see two editions, select the Community Edition. The current version available when this post was written is the version 12.1.4. You can also see that the download are available for Windows, Mac OS X and Linux. For this post I will download the Windows version. The download size for the Windows installer is around 130 MB.

Step 2. Install IntelliJ IDEA Community Edition

  • To begin, double-click the installer you’ve downloaded, for example ideaIC-12.1.4.exe.
  • You’ll be greeted with the following screen

IntelliJ IDEA Setup Welcome Screen

  • Press the Next button to continue.
  • You’ll be asked the installation location. On Windows it will be defaulted to the C:\Program Files directory.
  • Press Next for a couple of times until the installation complete.
  • When you choose to run the IntelliJ IDEA for the first time you’ll get the following screen
Installation Complete Screen

Installation Complete Screen

  • Press OK button to start IntelliJ IDEA for the first time. You will be shown a splash screen right after you press the button and continued by the screen welcoming you to the IDE.
Welcome to IntelliJ IDEA

Welcome to IntelliJ IDEA

Step 3. Now you have the IntelliJ IDEA Community Edition installed in your machine. Let’s create your first program using IDEA.

  • From the Welcome Screen above click the Create New Project menu.
  • A New Project dialog window will be shown. In this dialog you can do:
Create a New Project Window Dialog

Create a New Project Window Dialog

  • Enter the Project Type, choose Java Module.
  • Define the Project Name. We’ll just name it HelloWorld.
  • Choose the Project Location directory.
  • Select the JDK version you’ll be using.
  • Press the Next button followed by the Finish button to continue.

Step 4. IntelliJ IDEA Main Window, creating

  • Here is the Main Window of IntelliJ IDEA.
IntelliJ IDEA Community Edition

IntelliJ IDEA Community Edition

  • The bigger screenshot of the project explorer panel.
Project Explorer Window

Project Explorer Window

  • Before we create a class let’s create a package.
  • Right-click the src folder, continued by selecting the New and Package menu.
  • Enter the package name, for instance org.kodejava.introduction
  • To create a class right click on the newly created package, select New and Java Class menu.
  • In the Create New Class dialog enter HelloWorld in the Name text field and choose Class from the Kind dropdown selection.
  • Type the following code in the editor.
package org.kodejava.introduction;

public class HelloWorld {
    private String name;

    public String getName() {
        return name;

    public void setName(String name) { = name;

    public static void main(String[] args) {
        HelloWorld hello = new HelloWorld();

        String name = "world";

    private void sayHello() {
        System.out.println("Hello " + getName() + "!");
  • Press Shift + F10 or click the green Run button to execute your code.
  • And we are done!

Other things you can do next is to learn more about the menu and the keyboard shortcuts that you can use while working with the IDE. One good place is to look at the Help, Tip of the Day menu.

That’s finishes our introduction to the IntelliJ IDEA Community Edition IDE. I hope you can continue your learning and this IDE will surely help you to understand Java better. Because it is not just a tool to write code, it will give you a lot of suggestion so that you can always improve your code quality.

What’s needed to be prepared for learning Java programming?

At the time you decided to start to learn Java Programming you can start by downloading the Java Development Kit (JDK) from Java Download website. There are three different types of JDK, the Java SE (Java Standard Edition), Java EE (Java Enterprise Edition), Java ME (Java Mobile Edition).

From the website you can also download the Java API documentations which will sure be your first companion when learning the language. It is better also to download the Java Tutorial Series that was written by the Java experts.

In the tutorial you can learn from the basic of Java programming, introduction of the fundamental of Object-Oriented Programming (OOP) which is Java all about. Next you can also find trails in each subject of the API (Application Programming Interface) provided by Java library, such as the core package, how to communicate with a database, Java GUI programming, image manipulation, RMI, Java Beans Framework, etc.

When you want to write a code, you might wonder what editor or IDE you will need to use to start learning. A good text editor that supports a coloring will be a good candidate, colorful screen is better than just a black and white, isn’t it?

There are a lot of good text editor available today such as the VIM, NotePad++, TextPad, Editplus, UltraEdit. If you already have your preferred editor, you can use it of course.

If you’re ready for the big stuff, a bigger homework project, you might consider using an IDE (Integrated Development Environment) as you’ll be working with lots of Java classes, configuration files and build script for examples. There are many great IDE on the Java world from the free to the commercial product.

What IDE to use is really a developer decision, use whatever tools that can help you to improve your learning and programming activities. You can find IDE such as NetBeans, Eclipse, IntelliJ IDEA, etc.

Beside learning from the Java tutorials there are also many forums on the internet where you can discuss your doubts or your problems. Forums like JavaRanch, Stack Overflow are great forums with Java gurus that can help you to clarify your doubts and help you to solve your problem. Remember one thing when you ask for help, be polite, elaborate your problem clearly.

Good Java books on your desktop are good resources to study Java, from good books you can learn the nuts and bolts of the Java programming languages. When you have all your arsenal you can get the best out of you in learning Java. Have fun!