PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
ComPDFKit supports exporting form field data to XFDF files or importing form data from XFDF files. This is similar to annotation import/export (see Import and Export), but specifically for form fields (Widget).
Export Form Data
You can export form field data to an XFDF file by following these steps:
CPDFDocument document = new CPDFDocument();
document.open("filePath");
document.exportWidgets("exportPath.xfdf", "tempPath");Import Form Data
You can import form field data from an XFDF file to the document by following these steps:
CPDFDocument document = new CPDFDocument();
document.open("filePath");
document.importWidgets("importPath.xfdf", "tempPath");Export Complete Form Properties
In addition to exporting form fill values, you can also export complete Widget properties (including position, style, font, color, and all other configuration information). This is useful when you need to fully backup or migrate form structures.
CPDFDocument document = new CPDFDocument();
document.open("filePath");
document.exportCustomWidgets("exportPath.xfdf", "tempPath", null);Import Complete Form Properties
You can import complete Widget properties from an XFDF file to the document:
CPDFDocument document = new CPDFDocument();
document.open("filePath");
document.importCustomWidgets("importPath.xfdf", "tempPath");Form Import/Export Method Comparison
| Function | Method | Description |
|---|---|---|
| Form fill values import/export | importWidgets / exportWidgets | Only import/export form field fill values (user-entered data) |
| Complete form properties import/export | importCustomWidgets / exportCustomWidgets | Import/export complete Widget properties (position, style, configuration, etc.) |