Why does my XFDF not get imported into WebViewer?
There are several possible reasons WebViewer may fail to import an XFDF. As a first step, please open the developer console and check any warnings or error messages as it will give you additional information on the error.
**Invalid or Malformed XFDF **If the XFDF string is not well-formed XML or does not follow the XFDF specification, WebViewer may fail to import it.
**Custom Annotation Types Not Registered **If your XFDF includes custom annotation types (elements not in the PDF specification), WebViewer needs to have the corresponding custom annotation class registered. Otherwise, the annotation may not load or render properly.
**Missing Appearance Streams **By default, WebViewer exports appearance streams as references. If you import XFDF into a different document, these references may not exist, causing annotations to not display. Use the
generateInlineAppearances: trueoption when exporting to include full appearance data. Learn more about exporting inline appearances.**Custom Data Not Serialized **If you have custom properties (e.g., for custom annotations), ensure you override the
serializeanddeserializemethods to include this data in the XFDF. Otherwise, important properties may be lost on import. Learn more about annotation serialization.**Annotations Placed on Nonexistent Pages **If the XFDF references pages that do not exist in the loaded PDF, the annotations will not appear.
**Unsupported or Incorrect Annotation Types **Using annotation types not supported by WebViewer or with incorrect attributes may prevent them from importing.
**Incorrect Import Method **Using low-level PDF APIs (like
fdfUpdate) does not trigger redraws in WebViewer. Use the appropriate WebViewerimportAnnotationsAPI. Import & Export Annotations Guide**Widget/Field Annotations Not Imported Correctly **Widget and form field annotations may require additional form field data or specific import workflows. Ensure you are using the appropriate APIs and the latest WebViewer version.
**Custom Appearances **Custom appearances (beyond standard annotation appearances) may not be exported inline and thus may not import as expected. See Custom Appearances Guide
**XFDF Imported Before the Document Is Ready **If annotations are loaded from a server when the document opens, using importAnnotations() can sometimes lead to timing issues if the XFDF is imported before the document is fully ready. For annotations that should be loaded automatically with the document, we recommend using
setDocumentXFDFRetriever. See XFDF Import Guide
Last updated
Was this helpful?