1 import org.faceless.pdf2.*; 2 import java.io.*; 3 import java.util.*; 4 5 public class FormProcess 13 { 14 public static void main(String [] args) 15 throws IOException 16 { 17 PDF pdf = new PDF(new PDFReader(new FileInputStream(args[0]))); 20 Form form = pdf.getForm(); 21 22 System.out.println("PROCESSING FORM:"); 29 Map m = form.getElements(); 30 for (Iterator i = m.keySet().iterator();i.hasNext();) { 31 String key = (String )i.next(); 32 FormElement elt = (FormElement)m.get(key); 33 String val=null; 34 if (elt instanceof FormText) val = ((FormText)elt).getValue(); 35 else if (elt instanceof FormChoice) val = ((FormChoice)elt).getValue(); 36 else if (elt instanceof FormRadioButton) val = ((FormRadioButton)elt).getValue(); 37 else if (elt instanceof FormCheckbox) val = ((FormCheckbox)elt).getValue(); 38 if (val!=null) { 39 val=val.replace('\n','\t'); System.out.println(key+"=\""+val+"\""); 41 } 42 } 43 } 44 } 45 | Popular Tags |