These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Named Destinations

lucaso
Registered: Feb 5 2008
Posts: 49

1) Instead of names (a lot of overhead) can I use numbers, probably the original creation index and how do I obtain these?
2) Need the rect of destination to draw lines in script. How do I get these att's?
Do I cross the PDViewTree and how does one do this? GetAnnot("name") works only(?) on text-annots, not link-annots which as I understand are the basement of 'named destinations'.
3) How to create 'named destinations' in PDF lib-api/JS?

although pushing towards senior age, still want to keep up the pace

My Product Information:
Acrobat Pro 7.0.9, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
First, you need to state your question clearly. And please do not ask more than one specific thing.

Named Destinations cannot be created in JavaScript, they can only be used in JavaScript, and only if you already know the name. Please look in the Acrobat JavaScript Reference. If it's not in the referenence, then you either have to be an expert or it can't be done.

You can create destinations with a plug-in. Look in the SDK documentation for info in this.

There is a "doc.getLinks()" function. Again, look in the Acrobat JavaScript Reference. You can download it from this page:

http://www.adobe.com/devnet/acrobat/javascript.php

You can aquire the current information about the "View" with the "doc.viewState" property. Use this to find the destination rectangel.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

lucaso
Registered: Feb 5 2008
Posts: 49
Sorry, Thomp, I am pretty confused with all the different ways one can work with the SDK. I'm using a commercial lib to create the named destinations, but I would like to do the whole thing with the SDK. I create a link to the named destination, which had a "Square" -link around it. What I want is to go to it's dest and give the 'named'-link a bordercolor, in order to attract the users attention. I want to put the name of the link in a global, so page/link-events can put the colored border back to none. Sounds complicated but I think it will be of great convenience for the user. Something like drawing a box on the screen which gets disposed of by changing views, couldn't find anything that ressembles that.

although pushing towards senior age, still want to keep up the pace

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
If you want this level of control, then use a Button field instead of a link. You can access buttons with a name. From JavaScript, Links can only be found through thier position on the page.

From JavaScript, the only way to draw a box on the screen is to use an Annotation or a form field element. However, there are no events for changing views, other that page open and close events. So making the box appear and disappear is going to be a problem.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

lucaso
Registered: Feb 5 2008
Posts: 49
Hi thomp, could i use an annotation? one that does nothing but only changes borderwidth/color? that i can give a name. (no popup or maybe a copy of some text etc), one needs a name to acquire a reference.
A second weird question: can i use JS in VB.Net as if in Acrobat? My JSObject does not recognize the Martrix2D, I transformed the JS code to a VB-dll, that seems to work. Can i reference the js.zip's in VB?

although pushing towards senior age, still want to keep up the pace

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can use a Square annotation for your border, yes. And you can do more then just change the border color. You can hide/show, change it's size and location, and even change the page it is on. However, the standard markup annotations don't have events. So the code for controling the annot has to be somewhere else.

When using the JSO object in a VB or .Net application it's best not to put all the JavaScript code in the VB or .Net code. There is a problem with data types, and the effeciency and robustness of execution. Place all the JavaScript code into a folder level script, then call the code from the VB or .NET application. Pass only strings and numbers through JSO. This is much cleaner and puts the JS code where it needs to be, i.e., in Acrobat.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

lucaso
Registered: Feb 5 2008
Posts: 49
i think i understand, i should put ie the matrix2d-calculations in a folder or document-level script. But I would have to create the PDF with my bookmarks, named-dests and document-level scripts first, save it, reread it, using the scripts to place the links with the js-actions. I quess it can be done, the SDK reads back everything.... the commercial lib only executes one (the first) JS-action, just skips the rest..... but it does create all the named-dests. I read somewhere one creates a dest, which one places it's name with COS in the nametree. I haven't a clue how to do this.
Thanks for your reply, lucas

although pushing towards senior age, still want to keep up the pace

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You cannot access the PDF Name Tree with the IAC (the VB api you're using access Acrobat) or Acrobat JavaScript. It can only be done though the Acrobat plug-in SDK. Unless you are a C/C++ programmer you don't want to mess with this.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

lucaso
Registered: Feb 5 2008
Posts: 49
Thanks for your comments, I quess that my only REAL option is to dive in C++ if I want do it right. I leaned up against VB because it's incredibly easy, and try desperately to avoid C++. Just gave a quick look thru the Plugin-guide, yes, you're right, that's the way to go. I quess I won't be back for several months....

although pushing towards senior age, still want to keep up the pace