Setup: Maven, Gradle and License Key

Harry · 24 Sep 2026 · 1 views
Log in to track your progress and mark lessons complete.

Maven Dependency

<dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>itext7-core</artifactId>
    <version>7.2.5</version>
    <type>pom</type>
</dependency>

Gradle Dependency

implementation group: 'com.itextpdf', name: 'itext7-core', version: '7.2.5', ext: 'pom'

Adding the iText 7 Core dependency

Hello PDF

import com.itextpdf.kernel.pdf.*;
import com.itextpdf.layout.*;
import com.itextpdf.layout.element.Paragraph;

PdfWriter writer = new PdfWriter("hello.pdf");
PdfDocument pdf = new PdfDocument(writer);
Document document = new Document(pdf);
document.add(new Paragraph("Hello, iText!"));
document.close();

Always close() the Document — that finalizes and writes the file.

Share this post:

Comments (0)

Please login or register to comment.

Create a free account to keep reading

You've enjoyed a free tutorial! Register (it's free) to unlock every tutorial, track your progress and save code.

or sign in with your account

Already have an account? Log in