Miyagi
Miyagi

Reputation: 151

Form-fill XFA PDF with PDFBox

I'm trying to fill an XFA form using the example file using PdfBox 2 or 3 from: https://issues.apache.org/jira/secure/attachment/12964530/XFAFormFiller.java

I'm not so used to PDFBox so not sure how to correct it.

  1. I get compile errors. Basically how can I make it compile with latest PDFBox? Are my corrections below correct?
Line 107 I tried to fix with
Set<COSDictionary> objectsToWrite = new HashSet<>();

Line 121 I tried to fix with
COSWriter writer = new COSWriter(fos, new RandomAccessReadBuffer(baos.toByteArray()), objectsToWrite);

Line 128 I tried to fix with:
objectsToWrite.add(dataSetsStream);
  1. What format should the XML input file be? Can someone give an example? I get a corrupt PDF out with my corrections and feeding it the XML generated from dataSetsStream. The file I feed:
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
><xfa:data
><mycompany
>
.....
><mycompany
></dd:dataDescription
></xfa:datasets
>

Any help is appreciated.

Upvotes: 1

Views: 635

Answers (0)

Related Questions