Java – iText Write/Read PDF File Example – PdfReader + PdfWriter

Java-iText-Write-Read-PDF-File-feature-images

In the tutorial, we show how to Write/Read PDF File with iText library.

Create Maven Project

We create a Maven project with iText dependency:

Project structure:

Java-iText-Write-Read-PDF-File-project-structure

Write Text to PDF with iText

We use PdfWriter to write text to PDF file, WriteTextToPdfFile.java ->

We have a grokonez-itext.pdf file with 2 pages ->

Page 1:

Java-iText-Write-Read-PDF-File-write-to-pdf-page-1

Page 2:

Java-iText-Write-Read-PDF-File-write-to-pdf-page-2

Read Text from PDF with iText

We use PdfReader to read PDF text from each Page, ReadTextFromPdfFile.java ->

-> Results in console:

SourceCode

iTextJavaReadWriteTextPdfFile



By grokonez | November 1, 2018.


Related Posts


Got Something To Say:

Your email address will not be published. Required fields are marked *

*