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.
If you want to import or export forms with XFDF, you can use exportAnnotations and importAnnotations of annotationManager.
After the document is loaded, you can import the field values of XFDF (<fields>) with importAnnotations; each value goes to the field of the same name in the document. The type of XFDF can be String or File
await annotationManager.importAnnotations(xfdf)After the document is loaded, you can export the field values with exportAnnotations as XFDF string. Passing only the widgets as annotationList leaves out the other annotations. The widgets themselves are saved in the PDF.
const { Annotations } = instance.Core
const widgets = annotationManager.getAnnotationsList().filter(annotation => annotation instanceof Annotations.WidgetAnnotation)
const xfdfString = await annotationManager.exportAnnotations({ annotationList: widgets, fields: true })