Hi,

> Am 10.03.2016 um 10:20 schrieb Piotr Kulbicki <[email protected]>:
> 
> It doesn't return null. It returns empty list. From AR is it possible to 
> export data into xml.

you can try PDAcroForm.xfaIsDynamic() - if that returns true the form you are 
having is a dynamic XFA based form which doesn't have an 'classic' PDF fields 
as the form is rendered at runtime. To get the data you need to 

PDXFAResource xfa = PDAcroForm.getXFA();
Document xmlDocument = xfa.getDocument();

and then grab the xfa.datasets.data node from the xmlDocument. You could also 
get the xfa as a  byte[]  using xfa.getBytes() if you'd like to process it via 
XSLT or a streaming parser.

BR
Maruan


> Should I attache file into email?
> 
> With best regards
> Peter
> 
> Dnia 10.03.2016 o godz. 10:14 Gilad Denneboom <[email protected]> 
> napisaƂ(a):
> 
>> If getAcroForm returns null it means there are no form fields in the file,
>> at least not any valid ones...
>> 
>> On Thu, Mar 10, 2016 at 12:23 AM, Ruggentaler, JR <
>> [email protected]> wrote:
>> 
>>> How do I list and set/update the input fields in the attached PDF document
>>> using PDFBox? In the code snippet below form is null. If my PDF does not
>>> contain a PDAcroForm how do I access the input fields?
>>> 
>>> try {
>>> 
>>> pdf = PDDocument.load(new File(fileName));
>>> 
>>> PDAcroForm form = pdf.getDocumentCatalog().getAcroForm();
>>> 
>>> if (form == null) {
>>> 
>>> System.err.println("Error: This PDF does not contain a form.");
>>> 
>>> } else {
>>> 
>>> for(PDField pdField : form.getFields()){
>>> 
>>>   System.out.println(pdField.getValueAsString());
>>> 
>>> }
>>> 
>>> }
>>> 
>>> } finally {
>>> 
>>> close(fdf);
>>> 
>>> close(pdf);
>>> }
>>> 
>>> 
>>> JR
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to