iOS
ComPDFKit PDF SDK
Guides

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 XFDF

 

You can import annotations and form fields from an XFDF file to a document like so:

 

NSURL *url = [NSURL fileURLWithPath:pdfPath];
CPDFDocument *document = [[[CPDFDocument alloc] initWithURL:url] autorelease];

​NSString *path = [NSString stringWithString:xfdfPath];
[document importAnnotationFromXFDFPath:path];

 

Exporting to XFDF

 

You can export annotations and form fields from a document to an XFDF file like so:

 

NSURL *url = [NSURL fileURLWithPath:pdfPath];
CPDFDocument *document = [[[CPDFDocument alloc] initWithURL:url] autorelease];
​
NSString *path = [NSString stringWithString:xfdfPath];
[document exportAnnotationToXFDFPath:path];