I have a bunch of PDF's which I have merged by this point in the code. At the beginning of the merged PDF I have a contents page which links to said PDF's respectively. These pdfAction.gotoLocalPage
links sometimes don't work correctly and instead jump to between the bottom of the page and the next, however the PDF bookmark hyperlinks always work fine.
The code for the bookmark:
int pageToLinkTo=prevSectionPageCount+sectionPageCount+numberOfIndexPages+currentIndexPage+1;
document.put("Title", documentName);
document.put("Action", "GoTo");
document.put("Page",String.format("%d Fit", pageToLinkTo));
The code for the contents page link:
PdfAction action = PdfAction.gotoLocalPage(pageToLinkTo, new PdfDestination(PdfDestination.FIT,-1,-1,0), stamper.getWriter());
chunk.setAction(action);
Both of these evaluate to the same page. Could there be something wrong with the source PDF files? The only notable difference between the links which do work and the links that jump to the wrong place, is that the source PDF's have a slightly different page size (0.1 of an inch different).
Any help would be appreciated!
Thanks