Questions tagged [itext7]

Library to create and manipulate PDF documents in Java and C#. Use this tag for code using iText version 7 and higher. Use the "itext" tag for older versions up to 5.5.x. Remember to also add a tag for the language you're using.

For more on iText, see here.

For more on the differences between iText 5 and iText 7, see here.

2125 questions
8
votes
1 answer

Add an image to an existing PDF file with iText7

I want to add an image to a specific position inside an existing PDF file using iText7. In a different project using iTextSharp, the code was very simple: iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(new Uri(fullPathSignature)); //…
Mina Shtraicher
  • 99
  • 1
  • 1
  • 5
7
votes
2 answers

iText 7: How can I allow overflow in a Div?

I have a Div with a certain height: Div div = new Div(); div.setHeight(100); If, to the Div, I add a paragraph with several lines that would occupy an area higher than the Div, I receive the following warning: WARN…
ideaboxer
  • 3,863
  • 8
  • 43
  • 62
7
votes
1 answer

iText 7: Paragraph height as it would be rendered

I can set the width of a new paragraph as follows, which results in a certain height: Paragraph p = new Paragraph("some longer text some longer text some longer text"); p.setWidth(100); System.out.println("height " +…
ideaboxer
  • 3,863
  • 8
  • 43
  • 62
7
votes
2 answers

iText: Reduce image quality (for reducing the resulting PDF size)

What is the best practice for reducing the size of JPEG images in a PDF file, newly created using iText? (My objective is a trade-off between image quality and file size.) The images are created as follows: Image image = new…
ideaboxer
  • 3,863
  • 8
  • 43
  • 62
7
votes
1 answer

In Itext 7, how to get the range stream to sign a pdf?

I'm trying to migrate my application from iText 5.5.9 to iText 7 and I have a problem with signing a document on the server using a signature created on the client (described in the Digital Signatures for PDF documents). As the getRangeStream()…
David L
  • 175
  • 1
  • 14
6
votes
2 answers

What value to use for .MoveUp of canvas

The code below copies all pages from a PDF file to a new file and inserts on the first page a rectangle at the top with a red border holding a short text. If I don't move it, a gap will be left at the top (here enlarged a lot, font size is 8…
Gustav
  • 53,498
  • 7
  • 29
  • 55
6
votes
2 answers

How to get page size of pdf document iText 7

I have a java program in iText 7 that receive JSON data and generate a PDF document (with header and footer) that works fine with data in variable clientData in comment, but when use the variable in no comments clientData doesn't works, i'm getting…
davids182009
  • 441
  • 3
  • 7
  • 26
6
votes
2 answers

Itext Java 11: Illegal reflective access by com.itextpdf.io.source.ByteBufferRandomAccessSource$1

Recently upgraded to Java 11 and began performing a regression check. Currently get an Illegal reflective access error when trying to call com.itextpdf.text.pdf.PdfReader.close. Currently on Itext version 5.5.13 but also tried on itext 7.0.0 and had…
D. Millard
  • 63
  • 1
  • 5
6
votes
1 answer

How to split PDF document into small ones

I need to split a document into several small documents. For example, if document has 7 pages I need to generate 7 pdfs. In iTextSharp I was using the following code, works pretty well. However, in iText 7 its not possible to do it in the same…
Arsiwaldi
  • 513
  • 1
  • 7
  • 23
6
votes
2 answers

Issue with Column Width in IText 7 Tables

I have the following table created with fixed column width as follows, Table headerTable = new Table(new float[]{5,5,5}); headerTable.setWidthPercent(100); headerTable.addCell(new Cell().add(new Paragraph("Student Name : Michel…
Am Novice
  • 325
  • 2
  • 9
  • 21
6
votes
1 answer

Itext 7 - PdfReader is not opened with owner password Error

I am using This example for the latest Itext7 to fill in a document and I am getting this error: iText.Kernel.Crypto.BadPasswordException: PdfReader is not opened with owner password So I looked around the net I found that some people found…
Ahmad
  • 315
  • 4
  • 14
6
votes
1 answer

iText 7 can not set margin

I have an HTML string, i need to convert it to pdf, but pdf that i need must have specific size and margin. I did as the example show, now i have pdf with width and height that i set, BUT i can`t change or delete the margin, so pls help me. using…
Petr Gavrilov
  • 71
  • 1
  • 1
  • 4
6
votes
1 answer

Itext7 - Place Text at specific position

ColumnText ct = new ColumnText(writer.getDirectContent()); ct.setSimpleColumn(left,bottom,right,top); ct.setText(new Phrase("String")); ct.go(); This how we were doing in Itext 5 . But how can we place text on specific position on page . I have…
Raju Khinda
  • 121
  • 2
  • 7
6
votes
1 answer

how to rotate pages but not the text in iText?

I'm trying to create a PDF document with some pages in portrait and others in landscape, but seeing this example (iText7 - Page orientation and rotation) I found that the page rotates to landscape but the text also does it (PDF generated from iText7…
Raul
  • 465
  • 5
  • 16
6
votes
1 answer

Add Digital Signature to a PDF using IText 7

For IText 5, adding digital signature was fairly easy. The link for its documentation is: http://developers.itextpdf.com/examples/security/digital-signatures-white-paper/digital-signatures-chapter-2 Can someone share the link to documentation for…
kz2014
  • 324
  • 1
  • 4
  • 12