# Save pdf with annotations on server

**URL:** <https://pdfjs.community/t/save-pdf-with-annotations-on-server/643>\
**Category:** Technical Support\
**Created:** [March 18, 2021, 12:36pm UTC](https://pdfjs.community/t/save-pdf-with-annotations-on-server/643 "2021-03-18T12:36:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://pdfjs.community/u/Steven)\
**Post date:** [March 18, 2021, 12:36pm UTC](https://pdfjs.community/t/save-pdf-with-annotations-on-server/643/1 "2021-03-18T12:36:23Z")

</div>

Hi,

We want to save PDF with annotations on our server using API. Please provide documentation or code for save the PDF file.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [March 18, 2021, 12:36pm UTC](https://pdfjs.community/t/save-pdf-with-annotations-on-server/643/2 "2021-03-18T12:36:24Z")

</div>

**Hello, I’m an automated tech support bot.**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

- [Set XFDF using the Express REST API - Body params](https://pdfjs.express/documentation/utils/set#body-params)
- [Merging XFDF using the Express REST API - Body params](https://pdfjs.express/documentation/utils/merge#body-params)
- [Annotations - CustomAnnotationDeserializeHandler(element, pageMatrix, options)](https://pdfjs.express/api/Annotations.html#.CustomAnnotationDeserializeHandler__anchor)
- [API for Signing PDFs with PDF.js Express](https://pdfjs.express/documentation/signature/api)
- [API for PDF Measurement with PDF.js Express](https://pdfjs.express/documentation/measurement/api)

---

<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:** [March 18, 2021, 2:54pm UTC](https://pdfjs.community/t/save-pdf-with-annotations-on-server/643/3 "2021-03-18T14:54:21Z")

</div>

Hi,

This is a bit of a vague question but I will do my best.

To save the PDF as a blob, you can follow [this guide](https://pdfjs.express/documentation/basic-operations/save-document/blob). You will then want to send that blob to your server and then you can do whatever you wish with it. Note that the annotations WILL NOT BE SAVED into the document, as Express does not support this feature.

To export the annotations as XFDF, you can call:

```javascript
const xfdfString = await instance.annotManager.exportAnnotations({ links: false, widgets: false });

```

You can than either store that XFDF in a database, or merge it into the document on your server using some other library.

Alternatively, you can merge the XFDF using our [rest api](https://pdfjs.express/documentation/utils/merge).

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![Steven](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@Steven](https://pdfjs.community/u/Steven)\
**Post date:** [March 19, 2021, 5:29am UTC](https://pdfjs.community/t/save-pdf-with-annotations-on-server/643/4 "2021-03-19T05:29:48Z")

</div>

Thank you for your valuable reply. I will check and apply it our system.

---

<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:** [April 5, 2021, 2:17pm UTC](https://pdfjs.community/t/save-pdf-with-annotations-on-server/643/6 "2021-04-05T14:17:02Z")

</div>


