/* * Created on Sep 24, 2008 * */ package jPDFFieldsSamples; import java.util.Vector; import com.qoppa.pdf.form.FormField; import com.qoppa.pdf.form.TextField; import com.qoppa.pdfFields.PDFFields; public class EchoFields { public static void main (String [] args) { try { // Load the document PDFFields pdfDoc = new PDFFields ("input.pdf", null); // Get the list of fields in the document Vector fieldList = pdfDoc.getFieldList(); // Echo the fields for (int count = 0; count < fieldList.size(); ++count) { // Show the field name FormField field = (FormField)fieldList.get (count); System.out.print (field.getFieldName()); // Echo values for text fields if (field instanceof TextField) { System.out.println (" - " + ((TextField)field).getValue()); } else { System.out.println (); } } } catch (Throwable t) { t.printStackTrace(); } } }