I am unable to get the importfdf method working thats included in pdfbox. i'm using fdf that has been exported from the same form using foxit reader. Bizarely, if I use the exportfdf method in pdfbox, and then try and import back into the same form (which is blank again) I get another error. See stack trace below.

Any help, or examples from anyone who has this working would be appreciated.

Thanks
Andy


C:\PDFBox>importfdf.bat testform.pdf testform1.fdf testform1out.pdf
"C:\PDFBox\lib\pdfbox-1.6.0.jar;C:\PDFBox\lib\commons-logging-1.1.1.jar;C:\PDFBo
x\lib\fontbox-1.6.0.jar;C:\PDFBox\lib\jempbox-1.6.0.jar"
Apr 11, 2012 4:35:17 PM org.apache.pdfbox.pdfparser.XrefTrailerResolver setTrail
er
WARNING: Cannot add trailer because XRef start was not signalled.
Apr 11, 2012 4:35:17 PM org.apache.pdfbox.pdfparser.XrefTrailerResolver setStart
xref
WARNING: Did not found XRef object at specified startxref position 0
Exception in thread "main" org.apache.pdfbox.exceptions.COSVisitorException: Can
't write new ByteRange, not enough space
at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDoc ument(COSWriter.jav
a:1045)
at org.apache.pdfbox.cos.COSDocument.accept(COSDocume nt.java:456)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWri ter.java:1360)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocume nt.java:1121)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocume nt.java:1102)
at org.apache.pdfbox.ImportFDF.importFDF(ImportFDF.ja va:95)
at org.apache.pdfbox.ImportFDF.main(ImportFDF.java:73 )
java.io.IOException: Can't write new ByteRange, not enough space
at org.apache.pdfbox.pdfwriter.COSWriter.doWriteSigna ture(COSWriter.java
:669)
at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDoc ument(COSWriter.jav
a:1039)
at org.apache.pdfbox.cos.COSDocument.accept(COSDocume nt.java:456)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWri ter.java:1360)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocume nt.java:1121)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocume nt.java:1102)
at org.apache.pdfbox.ImportFDF.importFDF(ImportFDF.ja va:95)
at org.apache.pdfbox.ImportFDF.main(ImportFDF.java:73 )


(using fdf created by export using exportfdf method in pdfbox)

C:\PDFBox>importfdf.bat testform.pdf testformDATA.fdf testout3.pdf
"C:\PDFBox\lib\pdfbox-1.6.0.jar;C:\PDFBox\lib\commons-logging-1.1.1.jar;C:\PDFBo
x\lib\fontbox-1.6.0.jar;C:\PDFBox\lib\jempbox-1.6.0.jar"
Apr 11, 2012 5:05:06 PM org.apache.pdfbox.filter.FlateFilter decode
SEVERE: Stop reading corrupt stream
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -3
at java.util.ArrayList.elementData(ArrayList.java:371 )
at java.util.ArrayList.get(ArrayList.java:384)
at org.apache.pdfbox.pdmodel.interactive.form.PDAppea rance.getFontAndUpd
ateResources(PDAppearance.java:434)
at org.apache.pdfbox.pdmodel.interactive.form.PDAppea rance.setAppearance
Value(PDAppearance.java:268)
at org.apache.pdfbox.pdmodel.interactive.form.PDVaria bleText.setValue(PD
VariableText.java:131)
at org.apache.pdfbox.pdmodel.interactive.form.PDField .importFDF(PDField.
java:320)
at org.apache.pdfbox.pdmodel.interactive.form.PDAcroF orm.importFDF(PDAcr
oForm.java:120)
at org.apache.pdfbox.ImportFDF.importFDF(ImportFDF.ja va:58)
at org.apache.pdfbox.ImportFDF.importFDF(ImportFDF.ja va:93)
at org.apache.pdfbox.ImportFDF.main(ImportFDF.java:73 )