Import and Export Annotations to PDF Viewer as XFDF
According to the XFDF specification:
XFDF (XML Forms Data Format) is a format for representing forms data and annotations in a PDF document. XFDF is the XML version of Forms Data Format (FDF), a simplified version of PDF for representing forms data and annotations.
Examples
<?xml version="1.0" encoding="UTF-8" ?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="ACombo"><value>Red</value></field>
</fields>
<annots>
<square subject="Rectangle" page="0" rect="306.01,744.85,408.98,775.94" flags="print" name="447c49b7-5e50-4b13-adc8-c291102466e6" title="Guest" date="D:20171226120150-08'00'" color="#000000" width="5" creationdate="D:20171226120147-08'00'">
<popup flags="print,nozoom,norotate" page="0" rect="0,767,112.5,842" open="no"/>
</square>
</annots>
</xfdf>The fields section contains the names and values of any form fields in the document. In annots all of the annotation data is found.
In WebViewer
WebViewer provides methods to import annotations into the viewer from their XFDF data as well as export all currently loaded annotations as XFDF using AnnotationManager.
WebViewer also provides a way to get the XFDF data for annotations that have changed recently in the viewer. AnnotationManager.exportAnnotationCommand will get the XFDF data for annotations that have been added, modified or deleted since the last time exportAnnotationCommand was called.
A command looks something like this:
Commands can be imported using AnnotationManager.importAnnotationCommand. This is the technique that is used in the realtime collaboration example.
Last updated
Was this helpful?