# Do you have any example from PDF to database

**URL:** <https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196>\
**Category:** Technical Support\
**Created:** [August 17, 2020, 8:47am UTC](https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196 "2020-08-17T08:47:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)\
**Post date:** [August 17, 2020, 2:44pm UTC](https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196/2 "2020-08-17T14:44:15Z")

</div>

Hey there! Thanks for your interest in PDF.js Express.

PDF form data and annotations are serialized in XFDF format, which is just a XML like string that can imported/exported into the viewer.

To export the annotations into a XFDF string, you can use the [exportAnnotations](https://pdfjs.express/api/CoreControls.AnnotationManager.html#exportAnnotations__anchor) API.

```javascript
WebViewer({...options}, ele).then(instance => {
   const { annotManager, docViewer } = instance;

   // Call this when you want to save
   const saveAnnots = async () => {
      const xfdfString = await annotManager.exportAnnotations();
      // send XFDF to server for saving via AJAX here
   }
})

```

Later on, to load those form fields, you can simply call [importAnnotations](https://pdfjs.express/api/CoreControls.AnnotationManager.html#importAnnotations__anchor).

```javascript
WebViewer({...options}, ele).then(instance => {
   const { annotManager, docViewer } = instance;

   docViewer.on('documentLoaded', async () => {
     // load XFDF string from server here
     const xfdf = await fetchXFDFFromServer();
     await annotManager.importAnnotations(xfdf);
  })
})

If you have any more questions feel free to let me know.

Thanks,
Logan
```

---

_[View the full topic](https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196)._
