Save edited document on the same server with javascript

Hello team, I have programmed a button to download the modified or signed pdf, I would like to know if a copy of the modified pdf can be stored on the same server, it can be with javascript or php or both.

    instance.setHeaderItems(header => {
  header.push({
      type: 'actionButton',
      img : '/wp-content/themes/woffice/download-btn.png',
      onClick: async () => {
        const xfdfString = await annotManager.exportAnnotations();
        const saveOptions = CoreControls.SaveOptions;
        const options = {
          filename: 'myDocument.pdf',
          xfdfString,
          flags: saveOptions.LINEARIZED,
          downloadType: 'pdf'
        };
        instance.downloadPdf(options);
      }
  });
});

Regards

Hey Julio,

There are a few steps required to get the blob from WebViewer, which can be found in this guide.

There is also some sample JavaScript code in this guide to help save the blobs.

Let me know if you have any more questions,

Liam

Hi Liam, thanks for the answer, I have managed to implement it with js and php.

I have an additional consultation, no way to apply some adjustment in the document to not allow editing after haver downloaded the document?

For example this is a document that I have downloaded but it allows me to edit the document.

Regards

You should be able to put the document into Read Only mode:
https://www.pdftron.com/documentation/web/guides/annotation-permissions/#readonly-mode

You can also programatically disable specific functionality:
https://www.pdftron.com/documentation/android/guides/basics/pdf-read-only/

Liam