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 "itext5" 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

1610 questions
14
votes
3 answers

Itext7 generate pdf with Exception "Pdf indirect object belongs to other PDF document. Copy object to current pdf document."

i want to generate a pdf with itext 7,but some wrong happens to us: com.itextpdf.kernel.PdfException: Pdf indirect object belongs to other PDF document. Copy object to current pdf document. at…
Cheng.T
  • 199
  • 1
  • 9
13
votes
2 answers

Adding a new page in PDF using itext 7

I'm trying to create a PDF Document using iText 7 with below code and my PDF documents contents are overlapping in same page when generated.(i.e in Page 1). I see the document.newPage(); method is missing in iText 7. How can i add pages to my PDF…
Karthick Radhakrishnan
  • 1,011
  • 3
  • 11
  • 27
11
votes
3 answers

Continuous text in text-area cuts the PDF overflowing the text when using Itext 7.1.7

I see there are lot many questions related to the same scenario this one is little different couldn't figure out the solution. I have a in a tabl in a cell. When I give the continous text like…
Juke
  • 972
  • 2
  • 7
  • 20
10
votes
1 answer

What replaces chunk in iText 7?

Attempting to use iText 7 in java. Want to have part of a paragraph be bold. Apparently in earlier releases this was done by formatting "chunks" separately then adding them to the paragraph. Apparently "chunks" don't exist in iText 7. What is…
OldAndTired
  • 125
  • 1
  • 7
9
votes
1 answer

How to add a "Page X of Y" footer in iText 7

I'm trying to figure out how to add a "Page X of Y" footer to each page in a PDF document, which I'm generating using iText 7. Using an IEventHandler to generate the "Page X" part seems fairly straightforward - it's the "of Y" bit that I'm…
Dan King
  • 2,915
  • 3
  • 19
  • 21
8
votes
1 answer

Stamp on certain location of pdf using iText

I was trying to get the location using javascript and passed the coordinates to apply stamp on the stamp but it does not work properly. Below is the function I used to capture the coordinates of the mouse pointer. function divMove(e){ var div =…
8
votes
1 answer

iText 7.0.4.0 - Converting PdfDocument to byte array

I'm attempting to split a PDF file page by page, and get each page file's byte array. However, I'm having trouble converting each page to byte array in iText version 7.0.4 for C#. Methods referenced in other solutions rely on PdfWriter.GetInstance…
James.K
  • 105
  • 1
  • 5
8
votes
4 answers

Import itext-7 in android gradle

I am trying to add itext-7 to android, after adding the following in gradle compile 'com.itextpdf:root:7.0.0' I am still not able to find the classes of itext e.g PDFWriter etc. Please let me know if there's separate version for itext-7 for…
Ajji
  • 2,721
  • 2
  • 26
  • 28
8
votes
4 answers

how set custom color using itext 7

I cannot find a solution for a very simple question, how can I set a custom color for a text/line/etc. using iText7 in java code? I found this reply for iText5 but in version 7 there is no BaseColor class...
Balagex
  • 101
  • 1
  • 1
  • 4
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,083
  • 6
  • 36
  • 57
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,083
  • 6
  • 36
  • 57
7
votes
3 answers

Is it possible to merger several pdfs using iText7

I have several datasheets for products. Each is a separate file. What I want to do is to use iText to generate a summary / recommended set of actions, based on answers to a webform, and then append to that all the relevant datasheets. This way, I…
Matt
  • 1,434
  • 17
  • 27
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
  • 43,657
  • 6
  • 27
  • 48
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
  • 321
  • 1
  • 3
  • 17
6
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,083
  • 6
  • 36
  • 57
1
2 3
99 100