Skip to content

Commit 60db0f3

Browse files
committed
BlobBuilder has been deprecated, trying Blob support
1 parent 31782b1 commit 60db0f3

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

jspdf.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ function jsPDF(/** String */ orientation, /** String */ unit, /** String */ form
16971697
return API.output('dataurlnewwindow');
16981698
}
16991699

1700-
var bb = new BlobBuilder;
1700+
var bb = new BlobBuilderJS;
17011701
var data = buildDocument();
17021702

17031703
// Need to add the file to BlobBuilder as a Uint8Array
@@ -1708,7 +1708,15 @@ function jsPDF(/** String */ orientation, /** String */ unit, /** String */ form
17081708
array[i] = data.charCodeAt(i);
17091709
}
17101710

1711-
bb.append(array);
1711+
if (! $.browser.msie) {
1712+
var blob_data = new Blob([ array ], { type: 'application/pdf'});
1713+
var url = URL.createObjectURL(blob_data);
1714+
document.location.href = url;
1715+
return;
1716+
} else {
1717+
bb.append(array);
1718+
1719+
}
17121720

17131721
var blob = bb.getBlob('application/pdf');
17141722
saveAs(blob, options);

libs/BlobBuilder.js/BlobBuilder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
/*! @source http://purl.eligrey.com/github/BlobBuilder.js/blob/master/BlobBuilder.js */
1515

16-
var BlobBuilder = BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder || (function(view) {
16+
var BlobBuilderJS = Blob || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder || (function(view) {
1717
"use strict";
1818
var
1919
get_class = function(object) {

0 commit comments

Comments
 (0)