Re: Script to Fill Out Acrobat Forms
Re: Script to Fill Out Acrobat Forms
- Subject: Re: Script to Fill Out Acrobat Forms
- From: Doug McNutt <email@hidden>
- Date: Wed, 15 Jun 2011 12:47:31 -0600
At 12:49 -0500 6/15/11, Simon, Garry wrote:
>
>Hello, does anyone know if it's possible to write an Applescript, or call a JavaScript with an Applescript, to fill out forms in an Acrobat document? I have an often used Acrobat form with several nicely named fields in it that need to be filled out with data. I was hoping to automate the process of filling them out. I've hunted for documentation telling how to do this but can't find any.
I have had some luck filling out US income tax forms from Excel.
At one time it was easy because the format of a .fdf file was fairly simple and, once you know the from block names you can create a .fdf ab initio as a text file. Newer versions of Acrobat use a mix of ASCII and UTF-16 with the unicode parts, mostly field names, identified in a kind of parentheses delimited file.
It is possible to extract the .fdf data using the Acrobat reader. What I do is to fill out an IRS form with the line numbers as the entries, "Line32" for instance, and then extract the .fdf data.
It's now fairly simple to create a name-value file with the numbers to go into the lines. A quickie find and replace script can read that file and replace the line numbers with the actual values from a spreadsheet. You do have to be careful with those 16 bit quantities in the .fdf. Actually I use perl but AppleScript or Java could handle it. I doubt that JavaScript is a good choice unless you really need to look at the PDF using a browser..
Acrobat is happy to import the replacement .fdf file and print or save the filled out form as a pdf document unless some idiot has "protected" the file from being saved.
The code is a mix of undocumented tcsh, perl, and vba right now but I could be persuaded to document it if there is interest.
--
--> A fair tax is one that you pay but I don't <--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden