Fillable Form to Flat PDF to Fillable Form Yikes!
Hello Everyone,
I hope you are all doing well.
I have been searching for an answer to my problem for weeks now, and decided to finally ask my question. First, I have a 4-page fillable form document. It’s my template and contains all the form fields I need. When it’s a completed form it’s saved as flattened PDF. I’m trying to find a way to return that flattened PDF to a fillable form again so that I can export the data values into a spreadsheet. I want to eventually use the form fields as variables in a statistical program. I get the point and click way of doing this. Prepare form > Merge Data files into spreadsheet, ect., but I would like to use an Action in Adobe Pro that included a few “Execute JavaScript” steps.
I am brand new to JavaScript and automation within Adobe Pro but I’ve been experimenting with different code to achieve a solution. I’m willing to write all the code I need, but what I’m looking for is sample script to draw from.
I have an action that inserts pages before the target document(s). I scoured the internet for the following code (thank you to the maker of this You Tube video and Action Step: https://www.youtube.com/watch?v=bhbU3C7RIpE) that then grabs all the form fields from this template document, and places them on the target document:
for (var p=0; p<this.numPages; p++) {
for (var f = 0; f < numFields; f++)
{
name = getNthFieldName(f);
type = getField(getNthFieldName(f)).type;
rect = getField(getNthFieldName(f)).rect;
var newField = this.addField(name, type, p, rect);
}
}
Then I have step to delete the template. And another step to save the new target document. However, the resulting document is flawed. The target document has all the form fields from the template document but replicated on each page, so that each page contains all the form fields from the template document. This is not what I want.
If placed properly, it’s my belief that the form fields can tell JavaScript where to extract the data. Is this true? And if so, what would that code look like?
Also, not all the PDF forms are typed, but instead handwritten entries, so I know I will need an OCR step in an alternate Acrobat Action as well. What would be the best solution here? I feel that what I’m wanting is possible somehow, am I completely wrong? Please help!
Thank you so much,
JMagenta
