I am using following code to change zoom level of all hyperlinks to inherit zoom, but unable to change.
may be i have made some mistake in PdfName.DEST and condition because there is no array of DEST in pdf for first page( check out screen shot).
for (int count = 0; count < reader.getNumberOfPages(); count++) {
PdfDictionary page = reader.getPageN(count+1);
PdfArray annots = page.getAsArray(PdfName.ANNOTS);
if (annots != null) {
for (int i = 0; i < annots.size(); i++) {
PdfDictionary annotation = annots.getAsDict(i);
if (PdfName.LINK.equals(annotation.getAsName(PdfName.SUBTYPE))) {
if(annotation.get(PdfName.A)==null){
continue;
}
PdfArray d = annotation.getAsArray(PdfName.DEST);
if (d != null && d.size() == 5 && PdfName.XYZ.equals(d.getAsName(1)))
d.set(4, new PdfNumber(0));
}
}
}
}
I have created link in first page to second page, check out structure in image.
I have also try to use following code... i have debug and check value of d is null every time
for (int count = 0; count < reader.getNumberOfPages(); count++) {
PdfDictionary page = reader.getPageN(count+1);
PdfArray annots = page.getAsArray(PdfName.ANNOTS);
if (annots != null) {
for (int i = 0; i < annots.size(); i++) {
PdfDictionary annotation = annots.getAsDict(i);
if (PdfName.LINK.equals(annotation.getAsName(PdfName.SUBTYPE))) {
PdfArray d = annotation.getAsArray(PdfName.DEST);
// d is null every time
}
}
}
}