Some test text!

Save a document

Saving a document with JavaScript

After getting a Blob object, it's possible to save it from the browser using a library like FileSaver.js.

// using the FileSaver.js library saveAs function, but any technique to save a Blob from the browsers works
window.saveAs(blob, 'downloaded.pdf');

Alternatively, to send document blob data to your remote server.

const data = new FormData();
data.append('mydoc.pdf', blob, 'mydoc.pdf');
// depending on the server, 'FormData' might not be required and can just send the Blob directly

const req = new XMLHttpRequest();"POST", '/api/test', true);
req.onload = function (oEvent) {
  // Uploaded.


Get document data as a blob

After annotating or modifying a document you may want to save the entire document to your server. The most common way to send a document to a server is as a Blob object and WebViewer makes this easy by providing functions to get the document data as a Blob.

Get document data with a viewer
To get document data as a blob with a viewer.

Get document data without a viewer
To get document data as a blob without a viewer.

Learn more

Saving the updated PDF
To save an modified PDF changes back to a server or for downloading it.

Loading and saving annotations
To import/load and export/save annotations with a PDF document.

Saving a document in Salesforce
To save a PDF through WebViewer in a Salesforce deployment.

Additional external resources

Sending data with XMLHttpRequest
Mozilla documentation on sending binary data using XMLHttpRequest.

Sending data with fetch
Google documentation on working with fetch API.

Sending post request with jQuery
jQuery documentation on using post requests.

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