This content has been marked as final. Show 27 replies
What do you mean by "name" - the filename?
The URL. We need to copy and paste the address for the form and are currently doing this using MS Word.
Sorry about that!
will return the full path of the currently focused PDF.
Darn you Geo, I was on lunch! ;)
this.URL - document URL
this.baseURL - document base URL used for relative links
this.path - device-independant system path
this.documentFileName - just the filename portion (with extension), no path information
If the document is an XFA form (created in LiveCycle Designer) replace "this" with "event.target".
I have never done Java Script. What is the syntax for the "this URL" statement you mentioned?
Sorry, but I'm a novice when it comes to Java Script. All we've done is add fields to pdf forms and save them to be filled in.
Thanks again for the help!!
It's not "this URL". Note the period in between. That means you're accessing the "URL" property of the "this" object, which refers to the object that generated the event. No spaces, just "this.URL". The period is essential.
If you want to test, try this:
1) Create a button on a form
2) When the "Button Properties" dialog comes up go to the Actions tab
4) Type this in: app.alert(this.URL);
(make sure you type it exactly like that, with the semi-colon)
5) Click "OK"
6) Click "Close"
7) Choose the hand tool
8) Click on your button
That will pop up a warning saying the document is trying to connect to a URL. Click "Allow", then you will see a pop-up that shows you the URL of the document.
That works very well. The only problem is I'm not getting the first part of the URL (i.e. the full path including the server it's located on). Also, when the filename pops up, I can't cut and paste it to another location. Is there any way to do that in Acrobat?
Thanks for all your help (and patience!)
You can set a field's value with the following "Custom Calculation Script":
event.value = this.URL;
> The only problem is I'm not getting the first part of the URL (i.e. the full path including the server it's located on).
Note that if you are showing a file in the Acrobat or Reader window,
rather than in the browser window, the full URL is not available.
Thanks for trying! I guess we will still have to cut and paste links to our Acrobat forms using MS Word.
Or if you're viewing them off the web, set the AcroPDF Plug-In to open PDFs in the browser, then it will work as expected.
When you're viewing the PDF in the standalone application off the web (i.e. you have View PDF in Browser turned off), it actually downloads a copy to your Temporary Internet Files folder and opens it from there.
Strange, but "this.URL" works through version 7.
I'm not familiar with Live Cycle Design. Is it a separate Adobe product?
LiveCycle Designer is a product for creating XFA forms that ships and installs with Acrobat Professional 8.x.
Thanks again for all of the help! I did get the filename to display, but I can't cut and paste from the display. Is there any way to do this?
Put the result into a form field instead of an alert box. Then you'll be able to copy.
Please let me know how to get the result into a text box. The script that is displaying most of what I want is as follows:
I would guess that I need to change app.alert, but I'm not sure what to change it to.
Thanks again for all the help!!
Geo Kaiser already posted how to do this:
> You can set a field's value with the following "Custom Calculation Script":
> event.value = this.URL;
console.clear; // clear the opening dialog or other text
console.println(this.URL); // display the file's URL
I tried adding adding the following to my pdf file and now when I click the button nothing happens.
When I use the following, I get an alert of what I want but I can't cut and paste it:
I've also tried event value = (this path); and this hasn't worked yet either.
Thanks for the help!
Sorry, since 'show' and 'clear" are methods they need a '()'. So the script should read:
That did it!! Thanks again for all the help. A definite learning experience for the PDF Novice.
> event value = (this path);
Once again, you're missing the periods. They are extremely important. The code will not run without them.
It should read:
> event.value = (this.path);
Notice the periods between 'event' and 'value', and between 'this' and 'path'. Once again, those periods are required or the script will not run properly.
OK, well first off I must say THANK YOU! I have been scouring the internet for just this thing for days. I am new to java and forms overall but somehow found myself making new forms for the office in life cycle. The only thing I couldn't get to run was the baseURL function. NOt sure why but nothing shows up with that command but the other three work like a charm.
Is there any way to format the .path command to look more like a typical windows format? Example being instead of /C/document/ it would show C:\documents\ not a really big deal but would be nice. Again thank you!
> life cycle
Adobe's product suite is LiveCycle, not Life Cycle.
> Is there any way to format the .path command to look more like a typical windows format?
No, the paths are always in the device independant format - wouldn't work too well if someone opened your form on a Mac or Linux PC and you were trying to use Windows-style paths.
In the PDF properties open options tab, there is an option to to use the file name or document title on the title bar.
If all users are using version 6 or above there is the "documentFileName" property, and for version 5 and above there is the "URL" property.
Very helpful posts, I am trying to do something very similar to "even.target.path" in LCDesigner.
I used the out of the box button to "insert image" on my form which will work fine. The next 2 things I want will be based on whatever image the user chooses.
1. A separate field displays the path
2. A separate field displays the documentFileName
Finally I want to export these fields as XML to be loaded into InDesign. Or, what would be even better is to link the ID document to these fields so that if they are changed the ID links palette would change. This sounds fairly advanced to me so I would be very happy with 1 and 2 working.
None of this lives online, all internal and local.
I really look forward to your responses. Thanks!