Frameworks
React Native
Flutter
Version 10
Version 9
Version 8
Version 7
Version 6
Version 5
Depending on the type and origin of the XFDF or FDF, one of the following methods should be used:
MergeXFDF
API is the recommended solution for command XFDF filesSee below, which API is best suited to the given use case.
Document changes by default will automatically save to the PDF. Set PTDocumentController's automaticallySavesDocument to false to disable auto-save.
This is a 2-step process: first XFDF needs to be converted into FDF, then FDF needs to be passed to FDFUpdate
API. As a result of the import operation, the PDF document will have all annotations from XFDF and no other:
FDFUpdate
API works best for the scenarios like restoring annotations from a backup. Also it would be a good option when bringing in annotations creating in WebViewer, i.e. use FDFUpdate
to import XFDF written by WebViewer.
Note, FDFUpdate should be used only for the full XFDF files exported by Apryse API (Apryse SDK or WebViewer) from the same document. This method is not applicable to partial (incomplete) XFDF, because all the annotations that are not included in XFDF will be removed from the document. If XFDF was created by another tool, all widgets will be removed.
This is a 2-step process: first XFDF needs to be converted into FDF, then FDF needs to be passed to FDFMerge
API. As a result of the import operation, all the XFDF annotations will be added to the PDF document:
FDFMerge
API works best for bringing new annotations into a document from a partial XFDF and for adding annotations to an empty PDF document.
Note, FDFMerge does not modify the existing annotations. When an annotation is present in both XFDF and PDF, it will be duplicated.
It also works well for importing field-only XFDF (e.g. field data exported from other PDF solutions).
To prevent duplicates, remove all the annotations expected to be present in the PDF document from XFDF before using FDFMerge API.
This is a 1-step process: XFDF is passed directly to MergeXFDF
API. The API can both add and modify the annotations, but not delete them (except when using a command file). :
Note, MergeXFDF API relies on annotation names for matching the annotations. If XFDF file contains unnamed annotation, merge operation will be aborted with an exception. In order to proceed, set Force option, some annotations may be duplicated.
XFDF files exported using PDFNet API version 9.0 and higher always contain annotation names, even if the annotations in the PDF document don't have them. When imported, those annotations will still be matched correctly.
MergeXFDF
is also the API that should be used with command files (a flavor of XFDF with add-delete-modify instructions, see GetAnnotCommand
() or AnnotationManager.exportAnnotCommand
in WebViewer). In case of command XFDF, all operations specified by the command file, including deletions will be performed on the document.
Use case | API |
---|---|
Restoring annotations from backup |
|
Importing all changes made to annotations in WebViewer |
|
Importing form data exported from other PDF solutions |
|
Introducing several new annotations to a document while keeping the existing document's annotations |
|
Importing partial XFDF that contains modifications to annotations that already exist in the document (assuming XFDF annotations are named) |
|
Importing command xfdf file, which allows fast application of annotation changes made on another WebViewer or Apryse SDK instance. |
|
PDF Form fill and form data extraction
Full sample code which illustrates basic FDF merge/extract functionality and full support for FDF (Forms Data Format)
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales