Skip to main content
Known Participant
April 15, 2019
Question

How to add the location of a pdf file to the pdf that changes automatically if location changes like in Excel

  • April 15, 2019
  • 2 replies
  • 15524 views

I have Windows 10.  In Adobe Acrobat XI Pro, is there a way to add text to a pdf file that gives the path location of the pdf file that changes automatically if the location changes-similar to what MIcrosoft Word Excel does?  Please break your answer down to very simple, easy-to follow steps.

2 replies

Legend
April 23, 2019

Taking two of these points:

> I have no idea what these two replies mean-one from Mr. Isaacs,

>"Note that this solution only works for PDF renderers that support JavaScript!"

There is now a LOT of PDF reading software. As well as the Adobe software, there are Google Chrome, Microsoft Edge, FireFox, and the PDF readers built into phones and tablets. Most of these do NOT work with JavaScript, so any attempt to do clever stuff just won't work. If you're doing this for yourself, it may be fine. If you're doing it for other people, you can find things very difficult.

>  The second one is from "Test Screen Name" and says, "Use Prepare Form in Acrobat Pro."

>Adobe Acrobat is my least known software.

Sorry, wrong advice. You're using very old software, and Prepare Form is in the current version, Acrobat DC. Basically you go into creating or editing forms, which is different in every version to keep us on our toes!

Marie1575Author
Known Participant
April 23, 2019

Thanks

try67
Community Expert
Community Expert
April 23, 2019

If you're still unable to do it share your file via Dropbox, Google Drive, Adobe DC, etc., and I'll do it for you.

try67
Community Expert
Community Expert
April 16, 2019

Create a new text field. Call it "FilePath". Set it as Read-Only.

Go to Tools - JavaScript - Document JavaScripts and add a new script. Call it "load".

Delete any code that is generated automatically and replace it with this:

this.getField("FilePath").value = this.path;

Save your file. Close it and then re-open. The field should now display the current file path.

If you want the field to update when the file is re-saved (not only when it is opened) then place that code also under: Tools - JavaScript - Set Document Actions - Did Save.

Dov Isaacs
Legend
April 16, 2019

Note that this solution only works for PDF renderers that support JavaScript!

          - Dov

- Dov Isaacs, former Adobe Principal Scientist (April 30, 1990 - May 30, 2021)
Marie1575Author
Known Participant
April 18, 2019

Mr. Isaacs, thank you so much for your reply.  I worked on it.  I have not been able to "add a new text field.  How do you do that?.