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

Linking to different locations within a PDF

scosteve
Registered: May 23 2008
Posts: 4

Hi all - I've created a PDF via Livecycle, and I want to be able to link to different locations within the PDF in question. I'm basically going to have a table of contents at the top of the PDF, and when users click on the various topics, they will be routed to the topic they click on.....how do I do this in a PDF? Is there an example somewhere, or example code?

I've used the following to go to the tops of the various pages....

xfa.host.currentPage = 2;

.....but what I'm looking for is something more specific, namely how to go to specific sections within the various pages of the PDF. Thanks in advance for your help!

Steve

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There are a couple of things you can do. First, you can place bookmarks in an LC form. Of course if you have to change anything in the form you'll loose the bookmarks. And if your form is dynamic, static bookmark destinations probably won't work well anyway.

Something else you can do is use the "xfa.layout.pageContent" and/or the "xfa.layout.page" functions to identify the physical location of a form item you want to navigate to. Then use the "event.target.viewState" object to set the page view exactly the way you want.

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

scosteve
Registered: May 23 2008
Posts: 4
Thanks.....I'll approach this from a dynamic standpoint. I understand what you said.....however, I will ask for one more favor! I'm not very familair with javascript, so I'm not sure how to begin this process. Do I need to create variables for each object (i.e. text field) that I need to link to? Could you possibly provide a brief example as to what this would look like/how I need to start scripting, along with the pageContent script? I can then take it from there to try and figure out on my own - I just need help getting started!

Thanks in advance!

Steve
scosteve
Registered: May 23 2008
Posts: 4
Hi all - I have another question.....I'm trying to find a resource which explains exactly what all the javascript functions/parameters/arguments do....for instance....I've seen this:

xfa.layout.pageContent(0 , "field", 0);

What do "0, "field", 0 refer to? I'd like to find a resource which explains all of this - thanks again in advance!
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Navigation can get tricky so you'll have to learn some JavaScript. But there is one very easy thing you can do.

For example, if there is a text field on part of your form, say just below a section header, and you want to navigate to the section header. Then all you need to do to do is set the focus onto the field. Like this:

xfa.host.setFocus("xfa.form.Form1.P1.Section1Header");

The name of the text field is "Section1Header". The important part here is the SOM path that tells Acrobat where the field is. The path starts at the top of the form hierarchy "xfa" and decends all the way through the form hierarchy down the to text field, "Section1Header". The SOM path has to be correct. And there is a whole document on writing SOM Paths at the URL given below.

In order to set the focus, the field has to be active and editable. One thing you can do is place tiny check boxes in all of the navigation locations. Becareful, this method is not perfect and it does not change the zoom. For perfection you'll need to do a little more work to use the "doc.viewState" property.

You can look up the xfa.host.setFocus() function in the "XML Form Object Model Reference" which you can download from here:

http://partners.adobe.com/public/developer/xml/topic.php

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

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can look up just about everything you need in the "XML Form Object Model Reference" and you'll also find other documents and lots of info here:

http://partners.adobe.com/public/developer/xml/topic.php

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

Joselin
Registered: Jun 4 2008
Posts: 2
Hi there. I just tried 2 options.

1- I tried to use the following java script
xfa.host.setFocus("xfa.Form1.S1.S3.TF1");
in order to link a specific field (TF1)with a specific section of instructions at the bottom of the form and I had no succes neither.

2- I entered a text in the accessiblilty folder, "toolTip" field, but it does not show any information in the preview. I dont know if would have to bind it with smthg.

Any ideas of this? Thanks in advanced