# Saving the updated PDF

**URL:** <https://pdfjs.community/t/saving-the-updated-pdf/104>\
**Category:** Technical Support\
**Tags:** pdfjs-express\
**Created:** [June 30, 2020, 10:10am UTC](https://pdfjs.community/t/saving-the-updated-pdf/104 "2020-06-30T10:10:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jithinkp](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jithinkp](https://pdfjs.community/u/jithinkp)\
**Post date:** [June 30, 2020, 10:10am UTC](https://pdfjs.community/t/saving-the-updated-pdf/104/1 "2020-06-30T10:10:43Z")

</div>

I want save pdf to server after editing.I have try below method to save pdf to server.

```
instance.setHeaderItems(function(header) {
            header.push({
                type: 'actionButton',
                img: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',
                onClick: function() {
                    var docViewer = instance.docViewer;

                    var options = {
                        xfdfString: docViewer.getAnnotationManager().exportAnnotations()
                    };
                    var doc = docViewer.getDocument();
                    doc.getFileData(options).then(function(data) {
                        var arr = new Uint8Array(data);
                        var blob = new Blob([arr], {
                            type: 'application/pdf'
                        });

                        var data = new FormData();
                        data.append('mydoc.pdf', blob, 'mydoc.pdf');

                        var req = new XMLHttpRequest();
                        req.open("POST", '/pdf_editor/test/upload.php', true);
                        req.onload = function (oEvent) {
                            // Uploaded.
                        };

                        req.send(data);
                    });

                }
            });
        });

```

I have edit add new text and image in my pdf like below

 ![1](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/eedc9e19e2fbc9da2ae0447842c1406758b9aec0.jpeg)

After save unfortunately old pdf saving any edited data not updated in this file.

How write a code for saving pdf .Please help

---

<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:** [June 30, 2020, 2:19pm UTC](https://pdfjs.community/t/saving-the-updated-pdf/104/2 "2020-06-30T14:19:17Z")

</div>

Hi there,

PDF.js Express does not support merging the XFDF into the document on the client. To do this, you would have to use the [PDF.js Express REST API.](https://pdfjs.express/documentation/utils)

Specifically, you would need to use the [merge endpoint](https://pdfjs.express/documentation/utils/merge).

You can find a full end to end example [here.](https://pdfjs.express/documentation/use-case/upload-download)

If you have any more questions, please feel free to open a new 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:** [June 30, 2020, 2:19pm UTC](https://pdfjs.community/t/saving-the-updated-pdf/104/3 "2020-06-30T14:19:21Z")

</div>


