0

Is there any way to change the zoom level for Named Destinations? If it were a DEST entry one can simply use:

[...]
PdfArray d = annotation.getAsArray(PdfName.DEST);
if (d != null && d.size() == 5 && PdfName.XYZ.equals(d.getAsName(1)))
  d.set(4, new PdfNumber(0));

but for Named Destinations apparently there isn't any way to change the zoom. For example in the following link you see that on page 10 there isn't any "DEST" entry but an "A" one and the named destination is "se" but there isn't any way to change the zoom:

http://farm4.staticflickr.com/3846/14564676380_2f47b4b238_b.jpg

Many thanks in advance,

Cesar

Luo Kaisa
  • 147
  • 5

1 Answers1

0

What a truly strange question. The advantage of using a named destination is that the destination is stored separately from the annotation, yet you expect to find the destination in the annotation...

Please take a look at the following screen shot: enter image description here

The Catalog (or root dictionary) of a PDF has an entry called /Names. This entry can contain named JavaScript, named destinations, etc. In this case, you want the Dests entry. It's value is a name tree. In the screen shot, you see a string object AR that corresponds with the destination /XYZ 36 802 0 on page 20.

This name tree is where you should look for the destinations, not the annotation because the annotation only contains the name, not the destination itself (as you've already discovered).

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165
  • Thanks for your answer. I loaded the root dictionary and I locate the named destination "math", but I don't see where to change the zoom level on it, for example to "inherit zoom." There isn't any /XYZ as you see on the following link: [link](https://www.flickr.com/photos/cesarantoine/14754233952/in/photostream/) Many thanks in advance, Cesar – Luo Kaisa Jul 27 '14 at 05:39
  • You have a "Fit horizontal" (`/FitH`) destination. Are you on the same home work assignment as Butani Vijay and mail2vguna? Because all of this has been asked before. See for instance: http://stackoverflow.com/questions/24217657/set-inherit-zoomaction-property-to-bookmark-in-the-pdf-file – Bruno Lowagie Jul 27 '14 at 14:10
  • I came here because someone else has asked something about changing zoom levels for bookmarks or hyperlinks. But my question is about Named Destinations and apparently for it there isn't any way to change the zoom level. Thanks anyway. – Luo Kaisa Jul 27 '14 at 17:31
  • You have misinterpreted my answer. You can replace the `FitH` reference by an `XYZ` reference to inherit the zoom factor. That is explained in the other questions. – Bruno Lowagie Jul 28 '14 at 14:29