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
This commit is contained in:
Nils Maier 2013-09-01 16:45:26 +02:00
parent 8a4a6f498f
commit 16a1c38c1f

View File

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