Saving the updated PDF

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

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

How write a code for saving pdf .Please help

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.

Specifically, you would need to use the merge endpoint.

You can find a full end to end example here.

If you have any more questions, please feel free to open a new topic.

Thanks!
Logan