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.
XFDF is an XML-like standard from Adobe XFDF for encoding annotations and form field values. It’s compatible with Adobe Acrobat and several other third-party frameworks.
ComPDF ReactNative SDK supports both reading and writing XFDF to import and export annotations. This guide shows how to import and export annotations using the XFDF format.
You can import an XFDF file into the document by calling the importAnnotations(xfdfFile) method.
xfdfFile specifies the path of the XFDF file to be imported.assets directoryExample code:
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
configuration={ComPDFKit.getDefaultConfig({
})}/>
const importResult = await pdfReaderRef.current?.importAnnotations('xxx.xfdf');You can export the current annotations in the document to an XFDF file by calling the exportAnnotations() method:
Example code:
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
configuration={ComPDFKit.getDefaultConfig({
})}/>
const exportXfdfFilePath = await pdfReaderRef.current?.exportAnnotations();