We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

FDF file conversion to/from PDF / XML

Hi,

I would like to know if FDF to XML or PDF conversion and XML or PDF to FDF conversion is possible?

Thanks & Regards,

Sandhya

Hi Sandhya,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I am afraid your requested feature is not supported at the moment in Aspose.Pdf for Java. I have created a new feature request in our issue tracking system with issue id: PDFNEWJAVA-33138. Our development team will analyze and share their feedback regarding the support of this feature.

However, this feature is available in Aspose.Pdf for .NET and you can see the following documentation link for details and sample code:

Import Data from FDF into a PDF File (Facades)

Export Data to FDF from a PDF File (Facades)

Sorry for the inconvenience,

The issues you have found earlier (filed as PDFNEWJAVA-33138) have been fixed in Aspose.Pdf for Java 9.5.0.


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

Hi Sandhya,


Thanks for your patience.

In order to accomplish your requirements, please try using following code snippet with latest release of Aspose.Pdf for Java 9.5.0.

[Java]

String myDir = “D:\Temp\”;<o:p></o:p>

//changed document

com.aspose.pdf.Document doc = new com.aspose.pdf.Document(myDir + "PdfWithAcroForm.pdf");

try

{

((TextBoxField)doc.getForm().get_Item("textField")).setValue("new text value");

((ListBoxField)doc.getForm().get_Item("listboxField")).setSelected(3);

((RadioButtonField)doc.getForm().get_Item("radiobuttonField")).setSelected(2);

((CheckboxField)doc.getForm().get_Item("checkboxField")).setChecked(false);

doc.save(myDir + "Form_Updated.pdf");

}

finally

{

if (doc != null)

doc.dispose();

}

//export to fdf

com.aspose.pdf.facades.Form oldform = new com.aspose.pdf.facades.Form(myDir + "Form_Updated.pdf");

FileOutputStream fsold = new FileOutputStream(myDir + "export.fdf");

try

{

oldform.exportFdf(fsold);

}

finally

{

fsold.close();

if (oldform != null)

oldform.dispose();

}

//import from fdf into the source file

com.aspose.pdf.facades.Form form = new com.aspose.pdf.facades.Form(myDir + "PdfWithAcroForm.pdf", myDir + "Form_importFdf.pdf");

try

{

InputStream fs = new FileInputStream(myDir + "export.fdf");

try

{

form.importFdf(fs);

}

finally

{

fs.close();

}

form.save();

}

finally

{

if (form != null)

form.dispose();

}