Click to See Complete Forum and Search --> : javascript to add filename to pdf document


paul
12-17-2002, 05:20 AM
could someone please tell me if it's possible to create a script which would add a pdf file's filename to the document?

i have a large folder of one page pdf documents and i would like to automatically add the filename to the top right of the page.

i have NO experience with javascript! but I can create batch processing sequences in adobe acrobat if someone could assist me with the script part.

thanks in advance

paul

Charles
12-17-2002, 05:55 AM
For security reasons JavaScript runs in a sand box, it cannot communicate with the external world. But what you want to do is really easy with a number of server side methods. Which method you have at hand will depend on your server, though. So talk to your server people.

paul
12-17-2002, 06:04 AM
i don't think i explained myself very well.

my pdf files are local (i.e. on my hard drive)

i want to add each file's filename onto the page (so that when they are printed I know which paper copy corresponds to which electronic file)

i could add a text box manually to each pdf document and insert the filename myself -- BUT that would take a hell of a long time --- 2000 files!

acrobat has a batch processing capabililty (opening, printing, renaming etc.) and there is an "Excecute javascript" command which allows you to input your own Javascript.

SO... I wondered whether it was possible to create a script that would add a text box or field with the filename automatically.

if you think i'm barking up the wrong tree let me know, that might help also!

thanks,

paul

Charles
12-17-2002, 06:11 AM
Forgive me. I'm not familiar with using JavaScript with Acrobat (I use XSL-FO and Apache's Formatting Objects Processor to generate my PDF files) but on the web you get a file's URL with window.location.href and the short hand version, location, might also work.