Skip to main content
New Participant
December 22, 2011
Answered

extracting all form fields from a fillable pdf

  • December 22, 2011
  • 3 replies
  • 75660 views

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!!!

    This topic has been closed for replies.
    Correct answer try67

    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);
    }
    

     

    3 replies

    New Participant
    February 19, 2021

    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.

    try67
    Braniac
    February 19, 2021

    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...

    Participating Frequently
    November 3, 2020

    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:

     

    1.          With the PDF form open in Acrobat Pro, click on the “View” menu, then click on “Show/Hide” and make sure the “Tools Pane” is marked to display.  Then click on “Tools” (just under the main Menu, to the right of “Home”), then select “Prepare Form” from the Tool Pane (on the right side).  You’ll see in the bottom part of the Tool Pane a list of all of the fields in that PDF form.  Just above that list (and above the “FIELDS” title word), find the word “More” that has a dropdown indicator to its right.  Click on that dropdown indicator, then select “Merge Data Files into Spreadsheet”.  On the next screen, click on “Add Files”, then navigate to the location for the same PDF form file that‘s already open (I know; this seems repetitively silly), then click once on that filename & then click on “Open”.  On the next screen, click on “Export”, then pick the location and a name for this .csv spreadsheet file, then click on “Save”.  On the next screen, click on “View File Now”.  This should open that new file in Excel and you should see all of the field names listed across the top row and the next row down will display the source file name.  From here, you have at least two optionsYou can transpose the data in Excel (then just print it), or you can copy the data into Word if (like me) you’ll be more comfortable dealing with it there.

     

    1.         Transpose the data in Excel.  Easy to do, but watch out for “where” you put it.  Click on the “1” just to the left of the first row to select (highlight) that entire row of the spreadsheet, then copy it (right mouse click & select “Copy”).  Next, click once in any blank cell in that first column (e.g., A3), then right mouse click again, and (under “Paste Options”) select the fourth paste option (hover over it & it should say “Transpose”).  That should cause all of those field names to be listed vertically in the same order.  [It’s important to select a blank cell to start the vertical list or you’ll overwrite some (though not all) of the existing data in those first two rows.]

     

    1.         Copy the data into Word.  (Starting in the new spreadsheet from the point where all of the fields are listed across in the first row):  Click on the “1” on the far left of the first row to select (highlight) that entire row of the spreadsheet, then copy it (right mouse click & select “Copy”).  Next, open a new (blank) document in Word, then paste the copied data into this new document as just text (right mouse click & select the last Paste option – the one with a “T” in the image).  Now, all the field names are on the new Word document page separated by tabs.  From this point, you have more options:  You can easily create a vertical list of those field names [open Word’s Replace feature and type “^t” (w/o parentheses) in the “Find what:” box and “^p” (w/o parentheses) in the “Replace with:” box, then click on “Replace All”.  All of the fields will be listed vertically on the page in the correct order].  Or you can put them all into a one-column table [highlight the copied material, then click on “Insert”, then “Table”, then “Convert Text to Table”, and on the next screen, set the number of columns as “1”, make sure it’s set to separate at Tabs, then click on “OK”].  Of course, if the number of fields takes up too much vertical space in the document, whether they’re all formatted as just a vertical list or in a single column table, you can highlight the entire list (or table), then click on Layout, select Columns and make it a multi-column list to make better use of the page while still keeping all of the fields in their original order. 

     

    I hope someone finds some of all this useful.

     

    Paul

    try67
    try67Correct answer
    Braniac
    November 4, 2020

    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);
    }
    

     

    Participating Frequently
    November 5, 2020

    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

    Inspiring
    December 22, 2011

    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?

    New Participant
    December 22, 2011

    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!

    Inspiring
    December 22, 2011

    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.