iText pdfXFA
pdfXFA is an iText Core add-on for Java and C# (.NET) that allows you to flatten dynamic XFA forms to static PDF and add a digital signature as additional security for further processing in PDF workflows or for archiving.
How it works
The code below takes an XFA form, xfaform.pdf, as input and produces a visually equivalent flat PDF, flat.pdf. You can even test it yourself in our Demo Lab!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public static void main() {
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("xfaform.pdf"), new FileOutputStream("flat.pdf"));
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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(new FileStream("xfaform.pdf", FileMode.Open, FileAccess.Read), new FileStream("flat.pdf", FileMode.Create, FileAccess.Write));
}
Example files
Resources
Here you will find the needed resources to install and use pdfXFA.
Other resources
Why use iText pdfXFA?
Convert (flatten) dynamic and interactive XFA forms into static PDF documents, and add digital signatures to your forms, invoices and other important documents to further secure and give them legal status.
Flatten dynamic and interactive XFA forms into static PDF documents
pdfXFA allows you to use XFA as a template to render XML data to PDF and to preprocess XFA forms for subsequent PDF workflows.
Retain visual, structural and semantic information
As well as rendering a visually equivalent representation to PDF, pdfXFA retains visual, structural and semantic information, and adds this information to documents that adhere to archiving and accessibility standards.
Core capabilities of iText pdfXFA
Convert and protect your dynamic PDF files. When a form is finalized, prevent (accidental) modification by flattening it to static PDF, which can be digitally signed for further security.
Support for archiving and accessibility
pdfXFA provides support and allows you to create tagged PDF, PDF/A and PDF/UA.
Flatten your XFA files easily
This add-on easily flattens your XFA files using pdfXFA's convenience API