Extract xfdf from last created annotation without extracting all annotations xfdf from document

Product: PDFNet iOS (swift)

How to extract XFDF from last created annotation without calling the FDF extract from the entire document ?

When I create an annotation I want to extract it’s xfdf so I can save it to Database. I currently use the toolManager delegate method “annotationAdded” and I use the Doc saveAsXFDFToString function of the document to get the XFDF content. The problem is that I extract all annotations XFDF from document so when there are a lot of annotations, it creates a memory leak and crashes the application.

Is there a more optimised way of extracting one annotation xfdf ? I tried to implement the PTCollaborationServerCommunication protocol, but the documentation isn’t clear in Swift.

Thanks in advance for your help.


Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hi there,
If you would like to only extract XFDF information for a specific set of annotations in a document, you can use the following API on the PTPDFDoc class: PTPDFDoc.fdfExtractAnnots(_:)

Regarding the PTCollaborationServerCommunicationProtocol, do you have any specific questions about making an implementation of the protocol?

Hi Dluco, How did I miss that. Thanks for your help !