Copy link to clipboard
Copied
Is there any way of extracting/exporting/copying all form fields from a pdf? Meaning, the wordings from all the fields so I can pass it along to another individual to use for cross referencing, since they are not able to see all the various form fields within the split screen?
Thanks!!!
Or run this code from the JS Console:
console.clear();
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i)
var f = this.getField(fname);
if (f==null) continue;
console.println(fname);
}
Copy link to clipboard
Copied
Can you clarify exactly what you want to extract (e.g., field names, field values, the fields themselves, etc.) and in what form you want to deliver them to the other person?
Copy link to clipboard
Copied
The person that needs this is looking for the entire running list of all the fillable field names within the pdf. Any kind of document that I can deliver them in, I am willing to take suggestions.
Right now, what I was thinking of doing was having the screen split between the pdf and the listing of field names in the sidebar and taking screen captures as I scroll down the pdf and corresponding field names in the sidebar until I got all pages.
Is there an email address I could contact you at to discuss offline? I have an example I could send you but don't want posted online.
Thanks!
Copy link to clipboard
Copied
The easiest way would be to export a form to a spreadsheet. You do this in Acrobat 9 by selecting: Forms > Manage Form Data > Merge Data Files in to Spreadsheet. This will export the form data into a CSV file. The first row will contain the field names, the order of which depends on which version of Acrobat you're using. In 9, it's alphabetical order. You can remove any subsequent rows that contain the form data, and the other person can transpose the row of field names to a column of field names.
Copy link to clipboard
Copied
Thanks, I will give that a shot! I appreciate your responses to my question!!!!! Happy Holidays George.
Copy link to clipboard
Copied
I developed a tool that lists all the form fields in the file, and their
data, to the console, from where they can be easily copied to an Word file,
or just a plain text file. This tool will work in both Acrobat and Reader,
while other options will only work in Acrobat.
Have a look here:
http://try67.blogspot.com/2011/11/reader-display-form-data.html
Copy link to clipboard
Copied
This is an old thread and George_Johnson already has provided the most important required information: How to extract the field names from a PDF form and copy them into a spreadsheet document. From that point, he very reasonably assumed others already would know how to use Excel to convert (“transpose”) that horizontal row of cells containing the field names into a vertical column of cells with those field names in the correct order to make it easier to just print them all out.
Unfortunately, I didn’t happen to already know how to “transpose” in Excel, but it didn’t take long to figure it out. Suspecting there may be others who are similarly limited, I felt it might be useful to save them a bit of time and post the few additional steps necessary to end up with a text list of all the fields in a PDF form.
BTW - Although another poster provided a link for purchasing a tool to accomplish this (and much more), it seemed like an awfully expensive way to end up with just a list of those field names, which is a chore one might need to do just once or only rarely. So I decided to do it myself starting with Mr. Johnson’s excellent information.
Also, I need to mention that I don’t think this can be accomplished using just the Acrobat Reader (I don’t have it, so I can’t be certain). What I have is Acrobat Pro 2017 and I imagine Acrobat Pro DC probably works about the same for doing this. So just be sure you’re using a product with the necessary capabilities. (The steps below also assume your system has at least Excel installed; Word optional).
In Item 1., below, I’ve detailed the steps I used in applying Mr. Johnson’s information. In Item 2. I’ve described the additional steps for a couple of ways to end up with the list I wanted:
I hope someone finds some of all this useful.
Paul
Copy link to clipboard
Copied
Or run this code from the JS Console:
console.clear();
for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i)
var f = this.getField(fname);
if (f==null) continue;
console.println(fname);
}
Copy link to clipboard
Copied
Try67 -
Thanks a lot! I'll "try to try" that.
I do hope I can make it work, but - perhaps like a few other users - I'm not a programmer & really don't know what the Java Console is or can do. Something new to learn, I guess.
Thanks!
Paul
Copy link to clipboard
Copied
Try67-
Undoubtedly, you are FAR more advanced than I and likely more so than many others. I've looked for -- but could not find -- a "JS Console" within Excel. I unsuccessfully looked through all the menus on the ribbon and didn't find a reference to it, so I searched for "js console" in Excel under both "Help" and "Show Training" and got no results. Next, using Google, I searched on "2020 excel where is "JS console?" and still didn't find results that seemed to explain anything about how to get to it.
Can you provide a simple explanation for how to get to the "JS Console" and then how to "run code" from it?
I'm sure pieces of code (such as what you posted) are more efficient than all the steps I did without "code", but I just don't even know how to get to where I can try doing it. However, I'm definitely curious and eager to learn!
Paul
Copy link to clipboard
Copied
Use the Javascript console in Acrobat :
ctrl-j or cmd-j
Copy link to clipboard
Copied
The JS Console is in Acrobat, not Excel... To view it press Ctrl+J.
Then paste the code above into its lower part, select all of it with the mouse and press Ctrl+Enter to run it.
Before running it will look like this:
And afterwards it will be something like this:
These are the names of all the fields in the file (except for the last line, which will probably be "true").
Copy link to clipboard
Copied
Thank you very, very much! I'm glad to learn it wasn't something in Excel that I should have found!
Following your instructions and using your code, it all worked like a charm!
I certainly apologize for my ignorance and misunderstanding!
FWIW, after I read George_Johnson's original suggestion, I read your 12/22/2011 post and followed your link. For a one-time use, the price seemed high to me for what I assumed would be just automating the Transpose function in Excel, so I decided to figure out Transposing in Excel myself. However, now that I've gone back and re-read it all, I see that your 12/22/2011 post referenced "both Acrobat and Reader" and that the title at the linked page says "Custom-made Adobe Scripts", so I guess I really should have figured out back then that your suggestion was a complete alternative to what George_Johnson hadsuggested and would require starting over in Acrobat. Instead, I incorrectly assumed your suggestion picked up at the point George_Johnson's suggestion had stopped . . . with the user still in Excel.
Thanks so much for the clarification and for the very valuable new information!
Paul
Copy link to clipboard
Copied
BTW -
I did notice that the field list generated by your code was not ordered in the same sequence as those same fields are displayed on the list in the "Prepare Form" Tool in Acrobat Pro. Is there a reason for this? Does it make any difference for anything?
Thanks,
Paul
Copy link to clipboard
Copied
Paul,
I've been to countlee Excel classes and never shown the Transpose function! I clicked into your thread to search the solution for getting all my field names listed, then got a bonus as the transpose function will help me with a totally different task! Thank you so much for the careful step by step guidance!
Ken
Copy link to clipboard
Copied
Ken -
You're very welcome and I'm pleased to know I could help.
Paul
Copy link to clipboard
Copied
Thanks Paul! I did find this very useful. You probably saved a couple of hours of extra work for me.
Copy link to clipboard
Copied
@pdaltonlaw Thank you this is the best solution!!!!
Copy link to clipboard
Copied
Is there a way to programmatically perform "Merge Data Files in to Spreadsheet" to a lot of files? I checked out adobe pdf tool api, but it does not seem to support that.
Copy link to clipboard
Copied
No. You can collect the data from multiple files as a part of an Action and then export it with a script, but that's more work than simply using the built-in command, I think...