Skip to main content
sandrae5464
Participant
August 16, 2018
Answered

Getting filepath of document being stamped

  • August 16, 2018
  • 2 replies
  • 1611 views

I am creating a dynamic stamp that I need to populate with information from the file path of the document that is being stamped.  The file path contains a date that I need to parse out and input into the stamp.  Unfortunately, I have only been able to get the document name or the file path of the stamp itself. Using event.source.source.documentFullName only gives me the document name without the path.  Of course, this.path gives me the path of the stamp only.  Is there a way, using javascript in the stamp, to get the full path?

If this is not an option, I would need a way to prompt user to enter a date one time and be able to save that date to be used on subsequent stamping, so they don't have to enter it every time the stamp is used while Acrobat pro is open.  It can reset once it is closed.  The users need to stamp this specific date (and it is not the current date) on over 200 of the 500+ documents they review each time, and they don't want to have to enter it every time.

Anyone have any ideas?

I'm using Acrobat 2017 PRO.

This topic has been closed for replies.
Correct answer Joel Geraci

Below is the code I was trying to use, just to get the file path.


if(event.source.forReal &&
   (event.source.stampName == "#BTCdHJjSwT0lJjNTEhVfMC"))
{
    event.value = event.source.source.documentFilePath;
   
     
}


The Acrobat JavaScript documentation is your best friend. See the link for properties of the Doc Object which is what event.source.source returns.

Acrobat DC SDK Documentation

You want...

event.source.source.path

... which will return the device-independent path of the document including the file name. As you are parsing out the date from the path be aware that the device independent path may be different from what you are expecting on your OS.

2 replies

sandrae5464
Participant
August 16, 2018

tried that, it doesn't work.

try67
Community Expert
Community Expert
August 16, 2018

Use path instead of documentFileName...

sandrae5464
Participant
August 16, 2018

Yes, I did try that and it didn't work.  Wouldn't return anything.

try67
Community Expert
Community Expert
August 16, 2018

Post your full code, please.