XFA Flattener

No downloads or installation required!

Flatten an XFA-based PDF using our free online app, or learn how it works with our embedded iText 8 Sandbox (including the pdfXFA add-on).


Use the free online XFA Flattener app

Click the box to upload a XFA-based PDF, drag and drop a file into the box, or use the provided example file.

You will then be asked if you want to update the XFA data, or just flatten the XFA to a static PDF.

If you choose Update XFA Data you can edit the XML directly and download the updated unflattened XFA form. To view the updated XFA data you'll need to use a PDF viewer that supports XFA-based PDF forms.

Click Flatten XFA and then download the resulting static PDF file.

Or play in the iText 8 Sandbox

In this Sandbox you can see how the the XFA flattening code works in iText 8, and experiment with changing the code yourself.

Upload your own PDF containing an XFA form using Upload File and make sure the file name of the PDF you upload matches the name specified in private static final String ORIG.

import com.itextpdf.tool.xml.xtra.xfa.MetaData; import com.itextpdf.tool.xml.xtra.xfa.XFAFlattener; import com.itextpdf.tool.xml.xtra.xfa.XFAFlattenerProperties; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class PDFXfa { private static final String ORIG = "/uploads/input.pdf"; private static final String OUTPUT_FOLDER = "/myfiles/"; public static void main(String[] args) throws IOException, InterruptedException { XFAFlattenerProperties flattenerProperties = new XFAFlattenerProperties() .setPdfVersion(XFAFlattenerProperties.PDF_1_7) .createXmpMetaData() .setTagged() .setMetaData( new MetaData() .setAuthor("iText Samples") .setLanguage("EN") .setSubject("Showing off our flattening skills") .setTitle("Flattened XFA")); XFAFlattener xfaf = new XFAFlattener() .setFlattenerProperties(flattenerProperties); xfaf.flatten(new FileInputStream(ORIG), new FileOutputStream(OUTPUT_FOLDER + "flattened.pdf")); } }
using System; using System.IO; using iTextSharp.tool.xml.xtra.xfa; namespace PDFXfa { class Program { private static string ORIG = "/uploads/input.pdf"; private static string OUTPUT_FOLDER = "/myfiles/"; static void Main(string[] args) { XFAFlattenerProperties flattenerProperties = new XFAFlattenerProperties() .SetPdfVersion(XFAFlattenerProperties.PDF_1_7) .CreateXmpMetaData() .SetTagged() .SetMetaData( new MetaData() .SetAuthor("iText Samples") .SetLanguage("EN") .SetSubject("Showing off our flattening skills") .SetTitle("Flattened XFA")); XFAFlattener xfaf = new XFAFlattener() .SetFlattenerProperties(flattenerProperties); xfaf.Flatten(File.OpenRead(ORIG), new FileStream(OUTPUT_FOLDER + "flattened.pdf", FileMode.Create)); } } }
Disclaimer:

iText does not analyze the content of your uploaded or processed files. Users bear sole responsibility for the usage and content of their own files. All uploaded and processed files are deleted from our servers after users leave the page, or automatically after a period of 3 hours.



Contact

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now