0

Using Adobe Acrobat, if you choose Add or Edit Fields... from the Forms menu on a file with no fields, you get a pop-up with a message

Currently, there are no form fields in this PDF. Do you want Acrobat to detect form fields for you?

Is there a way of accomplishing this sort of of field detection using iText?

Isaac Kleinman
  • 3,994
  • 3
  • 31
  • 35

1 Answers1

2

Not out of the box but the API exists that you could build your own.

Adobe Acrobat is a PDF renderer and as such it can actually "look" at a PDF as a human does. It "sees" a line with text "near" it and can say with a fair amount of certainty that the line represents a field and the text represents the field's label. Same with circles and squares for radio buttons and check boxes. This document actually describes all of the shapes that Adobe Acrobat searches for.

Adobe's technology, however, assumes that a human will confirm and fix any problems that occur, usually using Adobe's technology:

After running the auto field detection process on a form, check it to make sure the correct fields have been created.

So even if iText supported this, you'd still have to open the PDF in Adobe Acrobat to check and fix things anyway.

But if you want to build your own you could use something like this or this to get at the lines. And this to get at the text.

Community
  • 1
  • 1
Chris Haas
  • 53,986
  • 12
  • 141
  • 274