There are errors once in a while because you are using the wrong method to concatenate documents. Please read chapter 6 of my book and you’ll notice that . iText is a library that allows you to generate PDF files on the fly. Please find more details on iText on below link. Here is a code. This HowTo is based on the iText package. You need a recent version (ex. 2.*). This a command line utility. You specify the pdf files to be merge into one.

Author: Zolotilar Dagul
Country: Guatemala
Language: English (Spanish)
Genre: Video
Published (Last): 12 February 2018
Pages: 342
PDF File Size: 3.96 Mb
ePub File Size: 2.16 Mb
ISBN: 170-8-52354-551-3
Downloads: 8701
Price: Free* [*Free Regsitration Required]
Uploader: Damuro

Sometimes this happens because the documents aren’t 8. Is there some way to detect the page size and then use that same page size for those documents?

Or, if not, is it possible to have it fit to page? This is my code:. Using PdfWriter to merge documents is a bad idea.


This has been explained on StackOverflow many times! If you need an example, see for instance the FillFlattenMerge2 example:.

Java: Merging multiple PDFs into a single PDF using iText. – BurnIgnorance

In your case, you also need to add page itexh, you can do this in a second go, as is done in the StampPageXofY example:. Or you can add them while merging, as is done in the MergeWithToc example. I strongly advise against using PdfWriter to merge documents!

As documented, you are throwing away all annotations by adding PdfImportedPage instances to a document using addTemplate. This is typically not what you want.

How to merge documents correctly?

You’re only making it harder on yourself if you insist on using that class. I don’t understand why so many people use the wrong approach to merge documents. I blame the unofficial documentation for the popularity of this wrong approach.

Skip to main content.

How to merge documents correctly? Manipulating existing PDFs iText 5. I would like to add a link to an existing pdf that jumps to a coordinate on another page. This is my code: