1

I try use

// Get the fields from the reader (read-only!!!)
        AcroFields form = pdfReader.getAcroFields();

But It's not enough, I want to get title of the field. I'm following this link.

In this PDF I can get the fields but I don't know how to get the titles: Client, Date, Address. enter image description here

Any idea?

Cabezas
  • 9,329
  • 7
  • 67
  • 69
  • 1
    Hmmm, you are referring to an example of a book without reading what is written in the book. If there is no `/TU` entry, then there is no "title of the field." What you see in your screen shot (the white text on the black background) is not the title of the field as far as the PDF is concerned. To the human eye, the title "Client" seems to be related to the field right below it. To a machine, there is no relationship between the text "Client" stored in the content stream and the field below that text stored in a field dictionary / annotation dictionary. – Bruno Lowagie Oct 06 '15 at 12:16
  • I think these texts are ourside of fields, they are others books. I think that PdfReader can read, because when I made http://stackoverflow.com/a/3343916/3240381 PdfReader copy these texts. But I don't know if I can get these books. – Cabezas Oct 06 '15 at 13:10
  • The texts are indeed defined in another place than the fields. They are part of the *content stream* of a page. `PdfReader` doesn't examine that content. It just passes that content to a `PdfCopy` or `PdfStamper` instance without worrying what the content is about. The fields are stored in PDF dictionaries. There's a references to these dictionaries from the `/AcroForm` `/Fields` array as well as from the `/Annots` array in a page dictionary. There is usually no relation between both, unless: (1.) your PDF is tagged, or (2.) sometimes a `/TU` is used. – Bruno Lowagie Oct 06 '15 at 13:16
  • I made reader.getAcroForm().getFields() and it's the same result than reader.getAcroFields().getFields(). So I don't know which is the dictionary where I have to look for this information. – Cabezas Oct 06 '15 at 15:22
  • 1
    Download [iText RUPS](http://itextpdf.com/product/itext_rups) and look inside your PDF. Do you see a `/TU` value? Also: by looking at iText RUPS, I hope that you see the difference between the content stream of a page (e.g. text such as Client, Address, Date,...) and the annotations that are added on top of a page (e.g. widget annotations of fields). It seems as you are totally unfamiliar with the technical vocabulary, which makes it very hard for anyone to answer your question. – Bruno Lowagie Oct 06 '15 at 16:23
  • Listen to Bruno :-) – Marco Schoolenberg May 29 '21 at 09:53

0 Answers0