Hi members,

How can I get the coordiantes of form fields from a exsiting pdf file?
I can get the list of the field names but have no idea on how to
retrieve the cooresponding coordinate vlaues (/Rect values ) for each
text field.
Here is the code I used. Any advise will be appreciated

         PdfDictionary dic;
         PdfAnnotation ano;
         PdfObject pobj;
         String field, name;
         PRAcroForm$FieldInformation fi;         

         PdfReader reader = new
PdfReader("myExistingPdf_with_Form_text_fields");
         PRAcroForm  acroForm = reader.getAcroForm ();
         ArrayList fields =  acroForm.getFields();
         Iterator iter =  fields.iterator();
         
         while (iter.hasNext())
         {
            fi = (PRAcroForm$FieldInformation)iter.next();
            name = fi.getName();
           //print form field name: works fine
           System.err.println"field name " +  name); 

           dic = fi.getInfo();
            pobj = dic.get(PdfName.RECT);
            if (pobj!=null)  // always null here
            {
               System.err.println(name +  ": " +
((PdfRectangle)pobj).left() + " " +
                                 ((PdfRectangle)pobj).right() + " " +
                                 ((PdfRectangle)pobj).top() + " " +
                                 ((PdfRectangle)pobj).bottom());        
        }
       } //while



Thanks.

Yongfu




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to