Hi.

I need to remove all Buttons from a PDF.
I am using the method form.removeField("Buttonname");

No I need to find out which fields are Buttons and which are not.
How can I do that??

I have tried it this way:
AcroFields form = stamp.getAcroFields();
com.sun.java.util.collections.HashMap fields = form.getFields();
com.sun.java.util.collections.Iterator it = fields.keySet().iterator();
        while (it.hasNext()) {
          String formname = (String) it.next();
          System.out.println("Name: " + formname);

            com.lowagie.text.pdf.AcroFields.Item items = (com.lowagie.text.pdf.
                AcroFields.Item) fields.get(formname);

            com.sun.java.util.collections.ArrayList values = items.widgets ;
            for (int i = 0; i < values.size(); i++) {
              com.lowagie.text.pdf.PdfDictionary dic = ( 
(com.lowagie.text.pdf.PdfDictionary) values.get(i));
              if (dic.get(PdfName.FT).toString().equals("/Btn"))
              {
                System.out.println("Button found Name: "+formname);
                break;
              }
            }

But it is not working, because it is also finding other "buttons" which are no buttons.

Any idea how I can do that??

Phil



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to