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

iText 5 getDefaultCell().setBorder(PdfPCell.NO_BORDER) has no effect

I'm new with iText and I'm trying to build a table. But for some reason table.getDefaultCell().setBorder(PdfPCell.NO_BORDER) has no effect, my table has still borders. Here is my code: PdfPTable table = new PdfPTable(new float[] { 1, 1, 1, 1, 1…
Mathias Mahlknecht
  • 281
  • 2
  • 6
  • 16
3
votes
1 answer

RTL alignment in itextsharp c#

I want to add Arabic text to my pdf. I need to do an RTL alignment. Hebrew text in PDF gives the answer how to do using PdfpTable. And using table.RunDirection = PdfWriter.RUN_DIRECTION_RTL; I can do that. But is there any other way to do so, when…
M.S
  • 288
  • 4
  • 12
3
votes
1 answer

Workaround for the same namespace defined in two assemblies using VB.NET

The iTextSharp assembly includes the BouncyCastle namespace in the core assembly, but the VB.Net application I am working with uses a different version of BouncyCastle already. I think C# could work around this by using "extern alias" but I can't…
Rattle
  • 2,393
  • 2
  • 20
  • 25
3
votes
1 answer

iText - crop out a part of pdf file

I have a small problem and I'm trying for some time to find out a solution. Long story short I have to remove the top part of each page from a pdf with itext. I managed to do this with CROPBOX, but the problem is that this will make the pages…
user2837742
  • 55
  • 1
  • 7
3
votes
2 answers

How can I convert XHTML nested list to pdf with iText?

I have XHTML content, and I have to create from this content a PDF file on the fly. I use iText pdf converter. I tried the simple way, but I always get bad result after calling the XMLWorkerHelper parser. XHTML:
danka
  • 51
  • 5
3
votes
1 answer

Set a fix background image for all my pages in PDF iText ASP C#

On Button Click, I generate 4 pages on my PDF, i added this image to provide a background image string imageFilePath = parent + "/Images/bg_image.jpg"; iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath); …
dandy
  • 67
  • 5
  • 13
3
votes
0 answers

Can I watermark XFA PDF using iText (commercial or not)?

Well, after spending quite some time playing with this, I think I may have found a solution soon after I posted the question. Bit embarrassing but hey, it seems to work now. I don't want to delete the question yet, in case someone wants the…
Cristian
  • 91
  • 10
3
votes
2 answers

Adding a Checkbox to a PDF Document using iText

I need to create a PDF Document using Java's iText libraries. I need to include as well some checkboxes, which are on/off depending on the value of some class variables. I've found some examples about interactive forms but I don't need this level of…
user2824073
  • 2,407
  • 10
  • 39
  • 73
3
votes
0 answers

PdfAWriter not converting unordered lists and tables

I'm having trouble using PdfAWriter class to convert my HTML to PDF, the HTML gets converted normally until it finds a table or a list. If I use PdfWriter class it works fine, but I need a PDF/A version. Here is the code I'm using to make the…
Fabio Pinto
  • 63
  • 1
  • 8
3
votes
1 answer

iText detached signature means

Could you please explain me more in details eventually giving me some example (one for attached and one for detached) of what iText detached signature exactly means? I found this wonderful documentation: iText digital signature pdf about iText…
aviking
  • 53
  • 1
  • 5
3
votes
1 answer

How to convert pdfstamper to byte array

In my application, i need to read the existing pdf and add barcode to the existing PDF and pass it to output stream. here the existing pdf is like template. I am using iText jar for adding barcode. I want to know the possibilities of converting…
user1636102
  • 121
  • 4
  • 11
3
votes
1 answer

Rupee symbol is not showing in android

Friends am using itextpdf-5.3.4.jar for creating pdf. For showing rupee symbol am using custom font. I tried arial.ttf,arialbd.ttf both this font but no luck rupee symbol is not showing. For showing the rupee symbol i have followed these links but…
Deepu T
  • 53
  • 7
3
votes
3 answers

Using iText: java.lang.OutOfMemoryError: Requested array size exceeds VM limit

I'vew been using iText 4.2.1 and java 1.6 to generate PDF-files. My task is to add two fields having some random content using a template pdf. It works fine even with an 1GB large PDF. But now the environment demands java 7 and I run into this Out…
Bo Öberg
  • 31
  • 1
  • 1
  • 3
3
votes
0 answers

Digitally Sign and Verify Pdf Document using itextSharp 5.3.3

I am trying to digitally sign and Verify pdf documents on server(c#) using iTextSharp 5.3.3. I have generated .Pfx file using DigiSign(Online tool) and then using windows to generate the certificate(.cer) file /// /// Signs a PDF document…
bayyinah
  • 139
  • 1
  • 3
  • 12
3
votes
1 answer

DocuSign and PDF/ITextSharp positioning issue with C#

I am having an issue with SignHereTabs appearing out of place in a DocuSign document. I use ITextSharp to take a PDF forms template with many fields, I set data into the fields leaving 2 signature fields named appropriately, I then use…