Hi, > Am 24.08.2015 um 09:15 schrieb Tolen Miller <[email protected]>: > > Hello, > > I am trying to load a fillable pdf file I created (using LiveCycle), but > cannot seem to get a hold of the fields. Is there anything obviously wrong > with the code below or could it be my form? > > PDDocument pdfDoc = new PDDocument(); > String fileTemplate = "D:\\PDFTemplates\\RPA_Template_Test.pdf"; > > try { > pdfDoc = PDDocument.load(fileTemplate); > PDDocumentCatalog docCatalog = pdfDoc.getDocumentCatalog(); > PDAcroForm pdfTemplate = docCatalog.getAcroForm(); > pdfDoc.getNumberOfPages(); > List<PDField> pdfFields = pdfTemplate.getFields();
if there is a PDAcroForm but there are no fields it's very likely a dynamic XFA form. If you are using PDFBox 2.0.0 you can use PDAcroForm.xfaIsDynamic(). If that returns true then you have a dynamic XFA form. For PDFBox 1.8.x you can use PDAcroForm.getXFA(). If that is not null and getFields() is empty again this means that you have a dynamic XFA form. Dynamic XFA forms do not contain 'regular' AcroForm fields. What is it what you would like to do with the form? BR Maruan > System.out.println( pdfFields.isEmpty() ); //always true > … > > Thank you, > Tolen Miller > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

