I have a pdf document with many form fields on it. I need to see the names of the form fields. Can I do this with Adobe Reader? Perhaps a third party tool..?
8 Answers
It's likely you'll find a user-friendly application to do this for you, but this is how I achieve it with a little VBScript...
Download and Install ABCpdf from webSupergoo, available here...
Copy the following script into a text file and save it with a '.vbs' file extension.
Place a copy of your PDF file into the same folder as the script, naming it 'myForm.pdf'.
Double-click the script file to run.
Set theDoc = CreateObject("ABCpdf8.Doc")
theDoc.Read "myForm.pdf"
theDoc.AddFont "Helvetica-Bold"
theDoc.FontSize=16
theDoc.Rect.Pin=1
Dim theIDs, theList
theIDs = theDoc.GetInfo(theDoc.Root, "Field IDs")
theList = Split(theIDs, ",")
For Each id In theList
theDoc.Page = theDoc.GetInfo(id, "Page")
theDoc.Rect.String = theDoc.GetInfo(id, "Rect")
theDoc.Color.String = "240 240 255"
theDoc.FillRect()
theDoc.Rect.Height = 16
theDoc.Color.String = "220 0 0"
theDoc.AddText(theDoc.GetInfo(id, "Name"))
theDoc.Delete(id)
Next
theDoc.Save "output.pdf"
theDoc.Clear
MsgBox "Finished"
After the script finishes you should find another PDF document named 'output.pdf' appears in the same folder, with all the field names overlayed on top of the fields.
I appreciate this question is a bit old but in case anyone else comes across it the PDF Toolkit will allow you to do this very simply with a command that looks like this (where the PDF you want the form fields from is called docsOfInterest.pdf:
pdftk docOfInterest.pdf dump_data_fields
-
1If the fields are too many, it better extract it somewhere else using output argument. e.g. using myDataFields as output file:
pdftk docOfInterest.pdf dump_data_fields output myDataFields
– JaiderDec 12, 2016 at 19:24 -
As far as I know you can't do it with Acrobat Reader. You can use their PDF writer program (Currently Acrobat XI) to do it, but it's fairly pricey.
I had to do the same thing for just a few documents. I just downloaded the trial version of deskPDF Studio X. From the menu, going to Forms > Modify Form Layout lets you see the name of the fields.
Be aware working with their free trial version will stamp documents with a watermark if you save the document.
There is a technical article on Aspose.com which explains how to identify form field names for PDFs. According to this article, you can achieve this by using the Java code on the page.
//First a input pdf file should be assigne
Form form = new Form("FilledForm.pdf");
//get all field names
String[] allfields = form.getFieldsNames();
// Create an array which will hold the location coordinates of Form fields
Rectangle[] box = new Rectangle[allfields.Length];
for (int i = 0; i < allfields.Length; i++)
{
// Get the appearance attributes of each field, consequtively
FormFieldFacade facade = form.getFieldFacade(allfields[i]);
//Box in FormFieldFacade class holds field's location.
box[i] = facade.getBox();
}
form.save();
// Now we need to add a textfield just upon the original one
FormEditor editor = new FormEditor("FilledForm.pdf", ”form_updated.pdf");
for (int i = 0; i < allfields.Length; i++)
{
// add text field beneath every existing form field
editor.addField(FormEditor.FLDTYP_TXT, "TextField" + i, allfields[i], 1, box[i].getX, box[i].getY(), box[i].getX() + 50, box[i].getY() + 10);
}
//Close the document
editor.save();
7 years later, but you can do this in Adobe Acrobat Pro DC as well.
You can Evaluate this javascript function in the document, as shown in attached screen shot, with instructions below.
- Click Javascript in the tools .
- Document Javascripts.
- Add a new function (the name of the function does not matter)
- Add this code exerpt
console.show();
console.clear();
console.println("Number of fileds: " + this.numFields);
for(var i = 0; i < this.numFields; i++)
{
console.println((i + 1) + ": " + this.getNthFieldName(i));
}
-
This is not possible on many forms which are "locked" to prevent editing. The JavaScript and other tools will be grayed out.... Saving a new copy is the workaround.– Brian ZJan 27, 2023 at 14:01
-
If the document is unlocked you can also just go to Forms > Edit and see the form names in the document itself.– Brian ZJan 27, 2023 at 14:09
This is now possible with the web inspector in Firefox. (Possibly since Firefox 106).
Open a PDF form in Firefox, right-click a form element, click "Inspect", and view the "name"
attribute in the PDF.js rendered HTML:
The top answer works but now you have to change the first line of code to:
Set theDoc = CreateObject("ABCpdf8.Doc")
to
Set theDoc = CreateObject("ABCpdf12.Doc")
or whatever your current version is.
In case of radial buttons I also recommend setting the font size to about 3 and saving a version like that as then you can see the whole field name.