Saving back to the same PDF

I've tried this in Java:

public static void fillForm(String pdf, String data){

try {

InputStream xmlInputStream = new FileInputStream(data);

Form myForm = new Form(pdf, pdf) ;//make the source and target the same

myForm.importXml(xmlInputStream);

xmlInputStream.close();

myForm.save();

}

catch (IOException e) {

e.printStackTrace();

}

and it fails with the following:

Exception in thread "main" com.aspose.pdf.exceptions.InvalidPdfFileFormatException: Incorect file format

at com.aspose.pdf.internal.pt.f.a(Unknown Source)

at com.aspose.pdf.internal.ok.y$a.a(Unknown Source)

at com.aspose.pdf.internal.ps.h.a(Unknown Source)

at com.aspose.pdf.internal.po.q.(Unknown Source)

at com.aspose.pdf.internal.po.q.(Unknown Source)

at com.aspose.pdf.internal.oo.b.ba(Unknown Source)

at com.aspose.pdf.internal.po.p.(Unknown Source)

at com.aspose.pdf.internal.oo.b.be(Unknown Source)

at com.aspose.pdf.internal.ml.f.aT(Unknown Source)

at com.aspose.pdf.internal.ml.f.(Unknown Source)

at com.aspose.pdf.ADocument.g(Unknown Source)

at com.aspose.pdf.ADocument.(Unknown Source)

at com.aspose.pdf.Document.(Unknown Source)

at com.aspose.pdf.facades.Facade.v(Unknown Source)

at com.aspose.pdf.facades.Facade.bx(Unknown Source)

at com.aspose.pdf.facades.AForm.(Unknown Source)

at com.aspose.pdf.facades.Form.(Unknown Source)

at com.aspose.AsposeTest.fillForm(

AsposeTest.java:27 at com.aspose.AsposeTest.main()

AsposeTest.java:15) Exception in thread "main"

Hi Brian,


Thanks for your inquiry. We have managed to notice the exception while saving back to same PDF document and logged an investigation ticket PDFNEWJAVA-34259 for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-34259) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.