Import Data into a PDF File - facades

Import Data from XML into a PDF File (facades)

Form class allows you to import data from an XML file to the PDF file using importXml method. In order to import data from XML, you need to create an object of Form class and then call the importXml method using the FileInputStream object. Finally, you can save the PDF file using save method of the Form class.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java
// Open document
com.aspose.pdf.facades.Form form = new com.aspose.pdf.facades.Form();
form.bindPdf("Template.pdf");
// Open XML file.
java.io.FileInputStream xmlInputStream = new FileInputStream("Template_xml.xml");
// Import XML data
form.importXml(xmlInputStream);
// close file stream
xmlInputStream.close();
// Save updated PDF
form.save("Template_output.pdf");
// dispose the form object
form.dispose();

Import Data from FDF into a PDF File (facades)

Form class allows you to import data from an FDF file to the PDF file using importFdf method. In order to import data from FDF, you need to create an object of Form class and then call the importFdf method using the FileInputStream object. Finally, you can save the PDF file using save method of the Form class.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java
// Open document
com.aspose.pdf.facades.Form form = new com.aspose.pdf.facades.Form();
form.bindPdf("Template.pdf");
// Open FDF file.
java.io.FileInputStream fdfInputStream = new FileInputStream("Template_fdf.fdf");
// Import FDF data
form.importFdf(fdfInputStream);
// close file stream
fdfInputStream.close();
// Save updated PDF
form.save("Template_output.pdf");
// dispose the form object
form.dispose();

Import Data from XFDF into a PDF File (facades)

Form class allows you to import data from an XFDF file to the PDF file using importXfdf method. In order to import data from XFDF, you need to create an object of Form class and then call the importXfdf method using the FileInputStream object. Finally, you can save the PDF file using save method of the Form class.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java
//Open document
com.aspose.pdf.facades.Form form = new com.aspose.pdf.facades.Form();
form.bindPdf("Template.pdf");
//Open XFDF file.
java.io.FileInputStream xfdfInputStream = new FileInputStream("Template_fdf.xfdf");
//Import XFDF data
form.importXfdf(xfdfInputStream);
//close file stream
xfdfInputStream.close();
//Save updated PDF
form.save("Template_output.pdf");
//dispose the form object
form.dispose();