Visually identify name of field in PDF form

2020-07-22 20:27发布

问题:

I know some similar issues exist (Find the field names of inputtable form fields in a PDF document?) but my question is different:

I have all the field names (in fdf file).

I wish I could visually identify directly on the PDF.

With acrobat I should be able to right click on a field and then select "display the name of the field" but I can find no such thing.

Can someone help me ?

回答1:

Ok. I have found pdf editor where this is possible. Probably acrobat pro too...

http://www.pdfescape.com/

Right click on the field : unlock. Right click again : get properties.



回答2:

If you're using Apache PDFBox to fill the form automatically, you can use it to fill all text fields with their name:

final PDDocument document = PDDocument.load(in);
final PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
final Iterator<PDField> it = acroForm.getFieldIterator();

for (PDField f : acroForm.getFields()) {
    System.out.println(f.toString());

    if (f instanceof PDTextField) {
        f.setValue(f.getFullyQualifiedName());
    }
};

document.save(...);

When you open the generated PDF, you'll be able to identify each field immediately like you asked.



标签: forms pdf fdf