Hi everyone,

[I sent this earlier this week but didn't see it come through - sorry
if others get it twice]

I'm currently trying to get my head around acrobat 7, and am finding
that if I take a pdf (with a form) that works fine, and edit it in
acrobat 7 (without changing anything in the form) and save it, I can
no longer find the form fields.

Upon further investigation, I find that my field names are now
prefixed with "F[0].P1[0]." and suffixed with "[0]", which I assume
means "form 1 page 1" or something similar.  The problem is, that when
I change my field names in the code to match these, I still can't set
the fields (despite setField returning true).

Here's the code I'm using:

       PdfReader reader = new PdfReader(".....");
       FileOutputStream fos = new FileOutputStream("....");
       PdfStamper stamp = new PdfStamper(reader, fos);
       AcroFields form = stamp.getAcroFields();
       Map fields = form.getFields();
       for (Iterator iterator = fields.entrySet().iterator();
iterator.hasNext();)
       {
               Map.Entry entry = (Map.Entry) iterator.next();
               System.out.println(entry.getKey() + " => " + entry.getValue());
       }

       String name = "F[0].P1[0].salesPersonName[0]";
       String salesPersonField = form.getField(name);
       System.out.println("salesPersonField = " + salesPersonField);
       boolean fieldSet = form.setField(name, "dim", "dim");
       System.out.println("fieldSet = " + fieldSet);

       stamp.close();
       fos.flush();
       fos.close();

the output of this is:

F[0].P1[0].salesPersonName[0] => [EMAIL PROTECTED]

....

salesPersonField =
fieldSet = true

(trimmed).

Any ideas on what I need to do to set these fields, or is it just not
possible to use 1.6 PDFs with forms?

cheers
dim


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to