Browse Source

Download: Use the typed array view instead of the buffer

The ArrayBuffer holding the data might be over-sized in case the
data length was not known during the transfer, e.g. when using a
Content-Encoding other than `identity` or when using a
Transfer-Encoding.
Only the view into the buffer has the correct length then, hence
always use the view directly when creating the blob URI for the
download, instead of the over-sized underlying buffer.

Closes GH-3627
Closes GH-3634
Nils Maier 12 years ago
parent
commit
16a1c38c1f
  1. 2
      web/viewer.js

2
web/viewer.js

@ -627,7 +627,7 @@ var PDFView = {
this.pdfDocument.getData().then( this.pdfDocument.getData().then(
function getDataSuccess(data) { function getDataSuccess(data) {
var blob = PDFJS.createBlob(data.buffer, 'application/pdf'); var blob = PDFJS.createBlob(data, 'application/pdf');
downloadManager.download(blob, url, filename); downloadManager.download(blob, url, filename);
}, },
noData // Error occurred try downloading with just the url. noData // Error occurred try downloading with just the url.

Loading…
Cancel
Save