This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/react-native/annotations/import-and-export/xfdf.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Import and export PDF annotations effectively

XFDF is an XML-based standard from Adobe XFDF (ISO 19444-1:2016)(opens in a new tab) for encoding annotations and form field values. An XFDF file will contain a snapshot of a PDF document’s annotations and form field values. It doesn’t include the form elements or the form fields themselves — only the filled values. It’s compatible with Adobe Acrobat and several other third-party frameworks.

XFDF has various limitations. In most cases, using Nutrient Instant will result in a smaller file and better synchronization.

Nutrient React Native SDK supports both reading and writing XFDF.

Importing XFDF

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

// Reference the XFDF file from the application's documents directory.
const xfdfImport =
Platform.OS === 'ios'
? RNFS.DocumentDirectoryPath + '/' + 'import.xfdf'
: 'file://' + RNFS.DocumentDirectoryPath + '/' + 'import.xfdf';
const result = await this.pdfRef.current
?.getDocument()
.importXFDF(xfdfImport);

Exporting to XFDF

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

// Get a temporary location on the file system with write access to store the exported file.
const xfdfOutput = RNFS.TemporaryDirectoryPath + '/test.xfdf';
const result = await this.pdfRef.current
?.getDocument()
.exportXFDF(xfdfOutput);

Refer to the XFDF.tsx example(opens in a new tab) in the Catalog example project for a runnable example.

Exporting annotations to XFDF via Adobe Acrobat

Adobe Acrobat can export annotations into XFDF. The export menu is part of the Comment tool and is accessed by opening the tool in the sidebar.

Adobe Acrobat Tools pane with an arrow pointing to the Comment tool, the starting point for an XFDF export

You can access the export function by clicking the three dots and choosing Export All To Data File….

Adobe Acrobat Comment pane options menu with Export All To Data File highlighted
  1. At the bottom of the page, choose Acrobat XFDF Files.
  2. Select the directory you wish to save the XFDF file to and name the file.
  3. Click Save.
Adobe Acrobat save dialog with Acrobat XFDF Files chosen as the export format

A successful export will result in a file with an .xfdf extension.

Exported Annotations.xfdf file icon next to the Adobe Acrobat window after a successful export

Importing annotations to XFDF via Adobe Acrobat

The export function is part of the Comment tool and is accessed by clicking its icon.

Adobe Acrobat Tools pane with an arrow pointing to the Comment tool, the starting point for an XFDF import

Click the three dots to open the import menu, and then click Import Data File….

Adobe Acrobat Comment pane options menu with Import Data File highlighted

Highlight the XFDF file you wish to import and click Select.

Adobe Acrobat file picker with Annotations.xfdf selected and the Select button ready to import it

The import function completes with the annotations being placed on the document.

Imported text box, ink, and stamp annotations in Adobe Acrobat, with four comments listed in the Comment pane

Adobe Acrobat error conditions

Error DescriptionScreenshot
Damaged/missing document body Adobe Acrobat XML parsing error dialog reporting a not well-formed XFDF file (error code 4)
Damaged/missing description tag Adobe Acrobat XML parsing error dialog reporting a mismatched tag in the XFDF file (error code 7)
Missing document flag Adobe Acrobat XML parsing error dialog reporting a general parsing error in the XFDF file (error code 42)