Hi,
I am trying to think of a way that applescript can interact with a PDF form and fill it out with previously defined variables.
It would be nice to know if this is possible or not.
Thanks for your help in advance,
Bruce
Hi,
I am trying to think of a way that applescript can interact with a PDF form and fill it out with previously defined variables.
It would be nice to know if this is possible or not.
Thanks for your help in advance,
Bruce
Yes, this is possible. I have written routines in Applescript that pass data to/from Filemaker databases.
The code below shows how to set an internal PDF variable. You would change the internal PDF variable to your variable. “this.” specifies the currently active PDF.
on setAcrobatTitle(theTitle)
set theScript to "this.info.title=" & quoted form of theTitle & ";" as text
my runAcrobatScript(theScript)
end setAcrobatTitle
on runAcrobatScript(theScript)
tell application "Adobe Acrobat Pro"
activate
do script theScript
end tell
end runAcrobatScript
Note that you are using JavaScript to do this. See the Acrobat JavaScript manual for your version of Acrobat.
Hope this helps!
Looks interesting, will have to take a look.
Out of curiosity will I be able to use set variables passed from earlier in the script to fill out the form.
I.E.
I have a field name “Order_Code” would I be able to set that value of that to the variable OrderCode which is fetched earlier in the script?
Thanks,
Bruce
EDIT:
Sorry I am quite new to apple script and a lot of my code is quite botched and I find it hard to understand some scripts.
Yes, you can do this. The fields in Acrobat can be referenced by name or number. I find it worth the time to reference by name in order to reduce errors.
Hi,
Sorry I am a bit confused by this script and not sure how to use it exactly.
EDIT:
I just noticed that use put in acrobat pro and the users of the script won’t be using acrobat pro they will be using adobe reader and only a few members of staff have access to pro and the ones who make what is in the PDF will be using adobe reader.
Will this be an issue?
Sorry for the confusion.
Thanks,
Bruce
Wow I didn’t know this was even possible. Is this something you can do in Preview as well or limited to Acrobat?
Because it would use javascript from acrobat I think it would only work with reader and acrobat pro as preview has a tendency to break javascript in PDF forms