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
46
votes
4 answers

Does anyone know of a fork of iText?

Now that iText has gone AGPL, I'm assuming someone is going to take the old (2.1.7 or 4.2.0) code and fork it to keep an LGPL version going. Does anyone know of such a fork already started?
Yishai
  • 90,445
  • 31
  • 189
  • 263
44
votes
7 answers

Compare these products for PDF generation with Java given requirements inside: iText, Apache PDFBox or FOP?

There were questions on that but not recently and technology must have gone ahead since then. Requirements: generating pdf documents based on predefined template (I can use either pdf forms or xsl-fo) being able to fill textual data being able to…
topchef
  • 19,091
  • 9
  • 63
  • 102
43
votes
6 answers

Hiding table border in iTextSharp

How can i hide the table border using iTextSharp. I am using following code to generate a file: var document = new Document(PageSize.A4, 50, 50, 25, 25); // Create a new PdfWriter object, specifying the output stream var output = new…
SharpCoder
  • 18,279
  • 43
  • 153
  • 249
43
votes
4 answers

iText landscape orientation and positioning?

I've just started to work with iText (5.4.2, latest version) and there are two things that I haven't yet managed to get straight. Creating documents in landscape. All pages are rendered portrait. Inserting images on a given position (number of…
user1111929
  • 6,050
  • 9
  • 43
  • 73
41
votes
2 answers

PdfReader not opened with owner password error in iText

With reference to this http://stackoverflow.com/questions/17524857/merging-pdf-in-asp-net-c-sharp/17525948?noredirect=1#comment25485091_17525948 question of mine, I have user IText for merging the pdf documents. I am getting " PdfReader not…
Ankur
  • 1,023
  • 7
  • 27
  • 42
41
votes
8 answers

Are there any Java PDF creation alternatives to iText?

I am trying to render about 100,000 - 80 column records through FOP and it tanks pretty much everytime (OutOfMemoryException). I know iText could handle that kind of load but I can't use it because of the LGPL license. Are there any alternative Java…
Mike C.
  • 1,035
  • 2
  • 8
  • 13
40
votes
7 answers

Using iText to convert HTML to PDF

Does anyone know if it is possible to convert a HTML page (url) to a PDF using iText? If the answer is 'no' than that is OK as well since I will stop wasting my time trying to work it out and just spend some money on one of a number of components…
Mark
  • 1,516
  • 2
  • 14
  • 24
39
votes
10 answers

Add Header and Footer for PDF using iTextsharp

How can I add header and footer for each page in the pdf. Headed will contain just a text Footer will contain a text and pagination for pdf (Page : 1 of 4) How is this possible ? I tried to add the below line, but header does not show up in…
Anuya
  • 8,082
  • 49
  • 137
  • 222
38
votes
13 answers

Dependency error in jasper-reports from itext

From yesterday I have problems compiling with maven because of iText jar. My project has a dependency of jasperreports-2.0.1 that depends on itext-1.02b or higher. com.lowagie itext
Laura Abad Avilés
  • 776
  • 1
  • 7
  • 16
38
votes
4 answers

Create PDF in memory instead of physical file

How do one create PDF in memorystream instead of physical file using itextsharp. The code below is creating actual pdf file. Instead how can I create a byte[] and store it in the byte[] so that I can return it through a function using…
acadia
  • 2,619
  • 18
  • 55
  • 72
38
votes
7 answers

c# itextsharp PDF creation with watermark on each page

I am trying to programmatically create a number of PDF documents with a watermark on each page using itextsharp (a C# port of Java's itext). I am able to do this after the document has been created using a PdfStamper. However this seems to involve…
tim harrison
  • 996
  • 1
  • 7
  • 12
37
votes
6 answers

How can I convert image url to system.drawing.image

I'm using VB.Net I have an url of an image, let's say http://localhost/image.gif I need to create a System.Drawing.Image object from that file. Notice save this to a file and then open it is not one of my options also i'm using ItextSharp here is…
Mina Gabriel
  • 23,150
  • 26
  • 96
  • 124
36
votes
7 answers

An invisible border of pdfptable

I am using iText library for generating pdf files in Java. I am writing data in pdfptable , how can I make the borders of table invisible?
yogsma
  • 10,142
  • 31
  • 97
  • 154
34
votes
2 answers

If identifying text structure in PDF documents is so difficult, how do PDF readers do it so well?

I have been trying to write a simple console application or PowerShell script to extract the text from a large number of PDF documents. There are several libraries and CLI tools that offer to do this, but it turns out that none are able to reliably…
dave walker
  • 3,058
  • 1
  • 24
  • 30
34
votes
11 answers

How do you create a PDF from XML in Java?

At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL…
Philip Morton
  • 129,733
  • 38
  • 88
  • 97