Questions tagged [itext]

Library to create and manipulate PDF documents in Java and C#. Use this tag for code using iText versions up to 5.5.x. For iText versions from 7.0.0 onwards a separate tag "itext7" is available. Remember to also add the tag for the language you're using.

iText is a library that allows you to create and manipulate PDF documents. It enables developers looking to enhance web- and other applications with dynamic PDF document generation and/or manipulation. Developers can use iText to:

  • Serve PDF documents to a browser
  • Generate dynamic documents from XML files or databases
  • Use PDF's many interactive features
  • Add bookmarks, page numbers, watermarks, etc.
  • Split, concatenate, and manipulate PDF pages
  • Automate filling out of PDF forms
  • Add digital signatures to a PDF file

Typically, iText is used in projects that have one of the following requirements:

  • The content isn't available in advance: it's calculated based on user input or real-time database information.
  • The PDF files can't be produced manually due to the massive volume of content: a large number of pages or documents.
  • Documents need to be created in unattended mode, in a batch process.
  • The content needs to be customized or personalized; for instance, the name of the end user has to be stamped on a number of pages.

Often you'll encounter these requirements in web applications, where content needs to be served dynamically to a browser. Normally, you'd serve this information in the form of HTML, but for some documents, PDF is preferred over HTML for better printing quality, for identical presentation on a variety of platforms, for security reasons, or to reduce the file size.

iText is available in Java as well as in C#.

Official website: https://itextpdf.com/

Useful links

Important

All versions prior to iText 5 (released in December 2009) are obsolete. Commercial and AGPL licenses for iText5 are available from iText Group. According to them, older versions should no longer be used due to technical and legal issues (read the Legal section in The Best iText Questions on StackOverflow for their opinion).

About iText 4

When you look at the Change logs, you can see that iText 2.1.7 was released on July 7, 2009. It was followed by iText 5.0.0 on December 7, 2009. There was no official release of iText 3 or 4. As explained on the official web site, iText jumped from version 2.1.7 to 5.0.0 to synchronize the version numbers of iText and iTextSharp. iTextSharp was already at version 4 while iText was still on version 2.

iText 7

As iText version 7 is a complete rewrite of the API, an additional tag has been introduced to mark questions explicitly referring to iText 7 usage.

Related tags

, ,

13154 questions
3
votes
2 answers

Using ItextSharp PdfPTable, table.TotalHeight returns 0.0, but expecting a positive float value

I'm using ItextSharp to create a PDF document with multiple PdfPTables. I group multiple PdfPTables using a list, and the list is created in a function and returned as a list. I then take the list and loop through it to add each PdfPTable to the…
Stanfrancisco
  • 352
  • 1
  • 7
  • 24
3
votes
3 answers

Fastest PDF->text library for .NET project

I'm trying to create an application which will be basically a catalogue of my PDF collection. We are talking about 15-20GBs containing tens of thousands of PDFs. I am also planning to include a full-text search mechanism. I will be using Lucene.NET…
n0e
  • 309
  • 3
  • 12
3
votes
1 answer

The type java.awt.geom.AffineTransform cannot be resolved. It is indirectly referenced from required .class files

I am generating PDF file using ItextPdf but I am getting an exception on this line canvas.addImage(background, width, 0,0, height, 20, 430); i.e. The type java.awt.geom.AffineTransform cannot be resolved. It is indirectly referenced from required…
3
votes
1 answer

How to Convert Docx to PDF in C# console application with out MS office installed on server

Hi I am trying to convert DOCX to PDF conversion in C# Console application. I found similar questions in stack overflow but didn't get the proper answer means unable to proceed with those approaches. string strFolderPath =…
3
votes
2 answers

iText - OutOfMemory creating more than 1000 PDFs

I want to create a ZipOutputStream filled with PDF-As. I'm using iText (Version 5.5.7). For more than 1000 pdf entries I get an OutOfMemory-exception on doc.close() and can't find the leak. ByteArrayOutputStream baos = new…
3
votes
1 answer

ITextSharp SetVisibleSignature not working as expected

So I have been working with the Java implementation of IText, but now I'm pretty much writing a port of our signing process to C#, and I've hit a snag. So when im signing my document using the SetVisibleSignature(rect, page, name) overload, it signs…
Johandre
  • 95
  • 2
  • 13
3
votes
1 answer

How can I Extract words with its coordinates from pdf using .net?

I'm working with pdf in hebrew language with diacritical marks. I want to extract all the words with its coordinates. I tried to use ITextSharp and pdfClown and they both didn't give me what I want. In pdfClown there are missing letters\chars in…
Alex K
  • 5,092
  • 15
  • 50
  • 77
3
votes
1 answer

table width not set in iTextSharp when converting html to PDF

I am trying to convert an html to pdf but the problem i face is that the html table tags width is not getting set correctly.. This is my html
SKumar
  • 33
  • 1
  • 1
  • 5
3
votes
2 answers

Generating pdftable with dynamic content using iText in android

I am generating pdf in android using itext library.Format of pdf is shown in image Approach i am using to generate this format is using Pdfptable. The description tag is dynamic means it can be of multiple lines. when description tag is of 4-5…
Sourabh soni
  • 488
  • 7
  • 11
3
votes
0 answers

Why is the setField code changing appearance

I am using form.setField(fm_form + "[0].Page1[0].SEXID[0]", 1 ) to set an Acrofield in a form. Is there a reason why it is changing the appearance from round sunken radio button to square radio with check, but not consistently??
john renfrew
  • 393
  • 1
  • 9
  • 30
3
votes
1 answer

iText: List of images in a cell

I would like to create a table that has a list of dots. I don't know ahead of time how many dots I have, but if they overflow the cell, I want them to wrap, just like text would. My code is something like this: PdfPTable table = new…
D. Cooper
  • 53
  • 5
3
votes
1 answer

iText setEncryption error

I've recently had to upgrade to iText, but I'm having problems getting setEncryption to work. I'm using iText 5.5.6. document = new Document(PageSize.LETTER, 36, 36, 72, 72); writer = PdfWriter.getInstance(document, out); writer.setEncryption(null,…
Beacon80
  • 349
  • 1
  • 4
  • 14
3
votes
1 answer

iText: setting PDF view defaults

I'm using iText for a bit of manipulating my PDFs through Java, and I'd like to make it so that a PDF default opens so that a single page fits in the window it opens, that this window is preferrably full screen, and that it has a thumbnail view on…
niklassaers
  • 8,480
  • 20
  • 99
  • 146
3
votes
3 answers

Create a PDF From a JSP Output

I have a webpage with a export option to PDF. I have to display the contents of the page in the PDF. Currently I use iText PDF Library to generate PDFs. The problem is creating PDF with iText is quite a challenge. Moreover we get frequent layout/UI…
SKR
  • 779
  • 4
  • 17
  • 31
3
votes
1 answer

extract folders from portfolio pdf java

I have a portfolio pdf with folders,subfolders and files. I need to extract the same structure as it is with folders,subfolders and files using iText in java. I am getting only files with EMBEDEDFILES. what is way of fetch folders also. Kindly find…
Nitesh
  • 33
  • 3