Some test text!


Saving the updated PDF

Once you've applied changes to the document data you'll probably want to do something with the updated PDF like letting the user download it or sending it back to your server.

If you just want to let the user download the edited file then no extra changes are necessary as pressing the download button will save the modified PDF to the user's computer. To add a custom save button, here is a code sample .

If you want to get the modified PDF as an ArrayBuffer then you can use the getFileData function on Document. For example:

  .then(instance => {
    const { documentViewer, annotationManager } = instance.Core;

    documentViewer.addEventListener('documentLoaded', async () => {
      const doc = documentViewer.getDocument();
      const xfdfString = await annotationManager.exportAnnotations();
      const options = { xfdfString };
      const data = await doc.getFileData(options);
      const arr = new Uint8Array(data);
      const blob = new Blob([arr], { type: 'application/pdf' });
      // upload blob to your server

Get the answers you need: Support

Upcoming Webinar: Live tech update & run-through: Redaction | March 31st at 11 am PT


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use