Yes, this functionality can be duplicated using JS, but it feels like re-inventing the wheel a bit... Have you tried using Save As (not just Save) after creating the named destinations in your file? That causes the file to be optimized and can reduce the file-size by quite a lot in some cases.
Thanks for Your tip using Save As after creating the named destinations. The file-size increases though, but not as much as it would have without executing Sav As.
You wrote that the "Named Destination" functionality is possible using JS. How can this task be solved using JS? Do You have a piece of sample JS Code for this?
I don't have sample code for this, although I have written scripts that do very similar things.
Basically you would need to save the viewState property when adding the "destination" and later on apply it when the user wants to go to that destination, or when your code does so.
However, unlike with the built-in Named Destinations, JS-based ones will not auto-update when pages are added/removed/moved around in the document, so the entire system will easily break when such an operation takes place.
Thanks for Your response. I've browsed the "Java Script for Acrobat API Reference" Guide and this is what I've learned about the viewState Property: The object is only defined within an embedded PDF. This is not the case in my task.
I'm not sure what they mean by "an embedded PDF"... But from my experience
that's incorrect. It is available in any PDF.
I'm using Acrobat Pro 8 (Operating System MS Win 7, 32 Bit). May this be a possible reason why I can't use the viewState Property properly?
That shouldn't matter, but keep in mind that using this object is not
trivial at all. It's an "opaque" object, which means you have no direct
access to the properties within it and editing it is not a trivial task.
I have done some scripts in the past that manipulated this object. If
you're interested, you can contact me privately (email@example.com) to
discuss it in detail.