Skip to content

Commit 9106c50

Browse files
committed
Fix(exporter): fix #3642 export pdf in IE
Should download pdf similar to downloading a csv when in IE, whereas all other browsers should open the pdf in place in a new tab (something that pdfMake cannot do in IE).
1 parent 3253caf commit 9106c50

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/features/exporter/js/exporter.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -991,30 +991,31 @@
991991
ieVersion = this.isIE();
992992
var doc = pdfMake.createPdf(docDefinition);
993993
var blob;
994+
994995
doc.getBuffer( function (buffer) {
995996
blob = new Blob([buffer]);
996-
});
997997

998-
if (ieVersion && ieVersion < 10) {
999-
var frame = D.createElement('iframe');
1000-
document.body.appendChild(frame);
998+
if (ieVersion && ieVersion < 10) {
999+
var frame = D.createElement('iframe');
1000+
document.body.appendChild(frame);
10011001

1002-
frame.contentWindow.document.open("text/html", "replace");
1003-
frame.contentWindow.document.write(blob);
1004-
frame.contentWindow.document.close();
1005-
frame.contentWindow.focus();
1006-
frame.contentWindow.document.execCommand('SaveAs', true, fileName);
1002+
frame.contentWindow.document.open("text/html", "replace");
1003+
frame.contentWindow.document.write(blob);
1004+
frame.contentWindow.document.close();
1005+
frame.contentWindow.focus();
1006+
frame.contentWindow.document.execCommand('SaveAs', true, fileName);
10071007

1008-
document.body.removeChild(frame);
1009-
return true;
1010-
}
1008+
document.body.removeChild(frame);
1009+
return true;
1010+
}
10111011

1012-
// IE10+
1013-
if (navigator.msSaveBlob) {
1014-
return navigator.msSaveBlob(
1015-
blob, fileName
1016-
);
1017-
}
1012+
// IE10+
1013+
if (navigator.msSaveBlob) {
1014+
return navigator.msSaveBlob(
1015+
blob, fileName
1016+
);
1017+
}
1018+
});
10181019
},
10191020

10201021

0 commit comments

Comments
 (0)