Hi,

I've tried this 2 ways of reading form data so far, and I don't know what I'm 
doing wrong.  The first time I did it I got field names that were meaningless 
to me, so I edited it in Designer 7 and then the field names became garbled.

I downloaded a form off the IRS's website for testing.
http://www.irs.gov/pub/irs-pdf/f1040ez.pdf

I ran it through this code:
PdfReader reader = new PdfReader("C:\\f1040ez.pdf");
        PRAcroForm form = reader.getAcroForm();
        
        if(form == null)
        {
            System.out.println("This form has no fields");
        }
        
        ArrayList list = form.getFields();
        
        for(Object o:list)
        {
            PRAcroForm.FieldInformation fieldInfo = 
(PRAcroForm.FieldInformation)o;
            
            System.out.println(fieldInfo.getName());
        }
reader.close();

and got output like this:
f1_002(0)
f1_003(0)
f1_004(0)
f1_005(0)
f1_006(0)
f1_007(0)
f1_008(0)
...
...
...

As you can see, field names aren't meaningful. I changed the first one to 
firstName and the second to lastName in designer 7 and then saved it.

When I ran the same code I got a bunch of null characters in the field names.  
So, I thought I was doing something wrong, and I used the code here: 
http://itext.ugent.be/library/com/lowagie/examples/forms/ListFields.java

With the code from the website it still had the null characters there.  I can't 
paste the contents here because yahoo doesn't let you paste null characters.  
Is there a workaround for this?  How can I change the field names to something 
meaningful without messing it up?  Is there another PDF editor I should use?

Thanks,
Joe




       
____________________________________________________________________________________Give
 spam the boot. Take control with tough spam protection in the all-new Yahoo! 
Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_html.html 
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to