How to view form field names in a pdf document

25

8

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

Billy Coover

Posted 2010-05-03T17:18:46.427

Reputation: 351

Answers

3

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

  1. Download and Install ABCpdf from webSupergoo, available here...

  2. Copy the following script into a text file and save it with a '.vbs' file extension.

  3. Place a copy of your PDF file into the same folder as the script, naming it 'myForm.pdf'.

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

AffineMesh

Posted 2010-05-03T17:18:46.427

Reputation: 632

37

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

shearichard

Posted 2010-05-03T17:18:46.427

Reputation: 563

If 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 – Jaider – 2016-12-12T19:24:58.433

2

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.

Jemmeh

Posted 2010-05-03T17:18:46.427

Reputation: 121

1

Apparently there's an online live demo of a package called AspPDF, that lets you do just that. You can find a direct link here.

t0mgs

Posted 2010-05-03T17:18:46.427

Reputation: 259

1

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

Mehper C. Palavuzlar

Posted 2010-05-03T17:18:46.427

Reputation: 51 093