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

Adding iText 5.5.6 to Android project with gradle exception

I am trying to add the iTextPDF library to a Android project using Android Studio (gradle). I add the library with compile 'com.itextpdf:itextpdf:5.5.6' instruction but I am getting an error: Error:Execution failed for task ':app:dexDebug'. …
Jose A Lopez Pastor
  • 337
  • 2
  • 4
  • 16
3
votes
1 answer

How can I get this iTextSharp Image to "float right"?

I'm adding an image to a PDF file like so: string imagepath = @"C:\Users\Default\"; if (System.IO.File.Exists(imagepath + "OfficeUseOnlyImgSmaller.png")) { iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance(imagepath +…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
3
votes
1 answer

class "org.bouncycastle.asn1.ASN1ObjectIdentifier"'s signer information does not match signer information of other classes in the same package

Can someone help me with this exception? Does this mean that I have to run keytool with the java version of 1.5? I had it working before, but now I get this. Exception in thread "main" java.lang.ExceptionInInitializerError at…
DenisMP
  • 973
  • 2
  • 16
  • 31
3
votes
1 answer

How to get rid of top padding in PdfPCell, iText 5

I am creating labels (as in Avery labels) using iText 5 tables. Positioning of label elements requires some very tight tolerances in order to fit everything on the label. My problem is that I have various zones on the label as PdfPCells. I need to…
Richard Roman
  • 43
  • 1
  • 4
3
votes
1 answer

How to open PDF file after being generated from a method

I need your help in opening the generated PDF file automatically after it is being written from a bean. I used iText libraries to write a PDF file and in the below method, I am able to generate the PDF, but I do not know how to open it on the fly…
99maas
  • 1,239
  • 12
  • 34
  • 59
3
votes
2 answers

How to generate gridview binded barcode to pdf?

I have grid which binds some barcodes from databas. This barcodes I want to generate in pdf. How can I do this? Sorry I dont have any idea how to do this so there is no sample code to show. My gridview name "GrdBarcode".Please help me.Below is my…
Semil Sebastian
  • 519
  • 2
  • 9
  • 24
3
votes
0 answers

com.lowagie.itext version 4.2.2 missing jar file in MVNrepository

We have an old project that uses Jasper Reports 1.3.4 (the last 1.x version produced) http://mvnrepository.com/artifact/jasperreports/jasperreports/1.3.4 It depends on com.lowagie.itext version [1.02b,) It appears that yesterday a version 4.2.2 was…
3
votes
1 answer

C#: iTextSharp, how can i edit the title property of a pdf-document?

I use the iTextSharp Library in my C# project to read and edit pdf documents. Now I want to change the title of a certain pdf-document. I searched a lot about this issue, but nothing really works for me. Best I found is following: PdfReader…
Fabian Froh
  • 31
  • 1
  • 2
3
votes
2 answers

Java: How to extract text by a selected area from a PDF file using iText?

I am working on a program that extract texts from a PDF file in a specific area, I am using java and iText library. Right now, i can extract data by taping the area coordinations using this code: import java.io.IOException; import…
Malek Boubakri
  • 820
  • 2
  • 17
  • 36
3
votes
1 answer

Adjusting format of PDF to print it faster

I am using a combination of iTextSharp and PdfSharp to assemble a large PDF file for printing to a Canon Oce VarioPrint 6000 series printer. The PDF is replacing a postscript file. Both this new file and the old are transferred to the printer via an…
Robb Sadler
  • 705
  • 10
  • 22
3
votes
1 answer

Converting images to PDF with iTextSharp preserve clipping path

We're looking to convert images in bulk to PDF, programmatically. So far it looks like we will be using iTextSharp but we have an issue with JPG images with clipping path. We are using the following code in our tests: using (FileStream fs = new…
Lars Thorén
  • 453
  • 2
  • 7
  • 22
3
votes
1 answer

Image rotation via itext pdf library

I am unable to rotate image from center or any fixed point by using itext pdf library in java program.When i rotate image it's x and y cordinate gets changed. Kindly help me in this regard. Image pdfImage=Image.getInstance("assets/product.png"); …
3
votes
3 answers

using iTextSharp.tool.xml not working

I Spend 3 days why adding namespace using iTextSharp.tool.xml not working not working. I already put itextsharp.dll in bin folders. Other related namespaces are working. Plz help.
Sahil Bhatia
  • 165
  • 1
  • 1
  • 8
3
votes
1 answer

C# ItextSharp Fontawesome Icons ( currency ) - PDF

i have problem is importing the icons (fontawesome-webfont.ttf) and showing them on PDF -but i am unable to show them on the PDF especialy currency icon (fa-money) some of the icons i was able to get it from the CultureInfo class if any thing i…
3
votes
2 answers

How to get the accurate font size(height) in pdf

I have a sample pdf (attached), and it includes a text object and a rectangle object that have almost the same height. Then I checked the content of the pdf by using itextrup as below: 1 1 1 RG 1 1 1 rg 0.12 0 0 0.12 16 50 cm q 0 0 m 2926 0 l 2926…
wendy
  • 33
  • 1
  • 5