Import & Export Annotations
XFDF is an XML-based standard from Adobe XFDF for encoding annotations. An XFDF file will contain a snapshot of a PDF document’s annotations and forms. It’s compatible with Adobe Acrobat and several other third-party frameworks. ComPDFKit supports both reading and writing XFDF.
Importing from XFDF
You can import annotations and form fields from an XFDF file to a document like so:
CPDFDocument document = readerView.getPDFDocument();
//the path of xfdf
String xfdfPath = context.getCacheDir() + "/xfdf/exportXFDF.xfdf";
//the transfer path of audio and video files
String tmpxfdfPath = context.getCacheDir() + "/tmp";
document.importAnnotations(xfdfPath,tmpxfdfPath);
readerView.reloadPages();
Exporting to XFDF
You can export annotations and form fields from a document to an XFDF file like so:
CPDFDocument document = readerView.getPDFDocument();
//the path of xfdf
String xfdfPath = context.getCacheDir() + "/xfdf/exportXFDF.xfdf";
//the transfer path of audio and video files
String tmpxfdfPath = context.getCacheDir() + "/tmp";
document.exportAnnotations(xfdfPath,tmpxfdfPath);