Create Index File(TOC) for merged pdf using itext library in java

You’re asking for something that should be trivial, but that isn’t. Please take a look at the MergeWithToc example. You’ll see that your code to merge PDFs is correct, but in my example, I added one extra feature: chunk = new Chunk(String.format(“Page %d”, pageNo)); if (i == 1) chunk.setLocalDestination(“p” + pageNo); ColumnText.showTextAligned(stamp.getUnderContent(), Element.ALIGN_RIGHT, new Phrase(chunk), … Read more

PDF Page re-ordering using itext

The selectPages() method is explained in chapter 6 of my book (see page 164). In the context of code snippet 6.3 and 6.11, it is used to reduce the number of pages being read by PdfReader for consumption by PdfStamper or PdfCopy. However, it can also be used to reorder pages. First allow me to … Read more