I'm looking for assistance in reading field names in an Adobe Dynamic XML Form (.pdf) with iText-5.0.4.
The PDF was created using Adobe LiveCycle Designer (version 8.2.1.4029.1.523496). http://itext-general.2136553.n4.nabble.com/file/n2547969/frmTestLetter.pdf frmTestLetter.pdf Using the method readFieldNames from part2.chapter08.XfaMovie at http://www.itextpdf.com/examples/iia.php?id=164 , looping through the fields to display the names produces nothing. I'm not sure if the problem is with my iText Java code, or with the original PDF (if so obviously a different forum). If I save the PDF as an Adobe Static PDF Form yes I can display the field names and populate the fields. The functionality I require eventually is for fields with a large amount of text to extend to a new page if necessary, requiring a dynamic form rather than a static one. package prjCreate_PDF_Templates; /* * This class is part of the book "iText in Action - 2nd Edition" * written by Bruno Lowagie (ISBN: 9781935182610) * For more info, go to: http://itextpdf.com/examples/ * This example only works with the AGPL version of iText. */ //package part2.chapter08; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Set; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactoryConfigurationError; import com.itextpdf.text.DocumentException; import com.itextpdf.text.pdf.AcroFields; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfStamper; import com.itextpdf.text.pdf.XfaForm; public class frmTestLetter { public static final String PATH = "C:/Users/dwyly/Documents/Code Library/aaJunk/Adobe play/"; /** The original PDF. */ public static final String RESOURCE = PATH + "frmTestLetter.pdf"; /** Shows information about a form that has an AcroForm and an XFA stream. */ public static final String RESULTTXT1 = PATH + "iTextTutorial/movie_xfa.txt"; /** * Main method * @param args no arguments needed * @throws IOException * @throws DocumentException */ public static void main(String[] args) throws IOException, DocumentException, ParserConfigurationException, SAXException, TransformerFactoryConfigurationError, TransformerException { frmTestLetter xfa = new frmTestLetter(); xfa.readFieldnames(RESOURCE, RESULTTXT1); } /** * Checks if a PDF containing an interactive form uses * AcroForm technology, XFA technology, or both. * Also lists the field names. * @param src the original PDF * @param dest a text file containing form info. * @throws IOException */ public void readFieldnames(String src, String dest) throws IOException { PrintStream out = new PrintStream(new FileOutputStream(dest)); PdfReader reader = new PdfReader(src); AcroFields form = reader.getAcroFields(); XfaForm xfa = form.getXfa(); out.println(xfa.isXfaPresent() ? "XFA form" : "AcroForm"); Set<String> fields = form.getFields().keySet(); for (String key : fields) { out.println(key); } out.flush(); out.close(); System.out.println("End of readFieldName method"); } } -- View this message in context: http://itext-general.2136553.n4.nabble.com/Dynamic-PDF-form-no-fields-recognised-tp2547969p2547969.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
