# 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:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ysc692](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@ysc692](https://pdfjs.community/u/ysc692)\
**Post date:** [August 17, 2020, 8:47am UTC](https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196/1 "2020-08-17T08:47:41Z")

</div>

Hello,

I was found your website your software can control the fill, do you have any example for this  
[https://pdfjs.express/documentation/forms/fill-form-fields](https://pdfjs.express/documentation/forms/fill-form-fields).

One more you have example for PDF field to Database or Ajax call?

Thank s

---

<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
```

---

<div class="post-metadata">

**Author:** ![ysc692](https://avatars.discourse-cdn.com/v4/letter/y/58956e/32.png) [@ysc692](https://pdfjs.community/u/ysc692)\
**Post date:** [August 19, 2020, 8:28am UTC](https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196/3 "2020-08-19T08:28:48Z")

</div>

Thank you for your help!

One more question.

I want to create the “input text box” field on pdf

When i click submit button can read the “input text box” field value"

Can you help and let me know to did it.

Thank you!!!

---

<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 19, 2020, 2:25pm UTC](https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196/4 "2020-08-19T14:25:45Z")

</div>

Hi,

Expres does not have the ability to create form fields on a PDF, it can only read existing ones. If you need the functionality to create form fields, you can take a look at our sister project. [PDFTron WebViewer](https://www.pdftron.com/documentation/web/)

If you have any more questions about this, feel free to open a new topic. (I am going to close this topic so it doesn’t get off topic)

Thanks!  
Logan

---

<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 19, 2020, 2:25pm UTC](https://pdfjs.community/t/do-you-have-any-example-from-pdf-to-database/196/5 "2020-08-19T14:25:48Z")

</div>


