您好,请参考这篇文章:
https://blog.csdn.net/me_never/article/details/85568126
代码如下:
- spread.savePDF(function (blob) {
- var fileName = $('#pdfFileName').val() || 'download';
- // saveAs(blob, fileName);
- if(window.navigator && window.navigator.msSaveOrOpenBlob){
- var ieBlob = new Blob([resp.data],{type:'application/pdf'});
- window.navigator.msSaveOrOpenBlob(ieBlob);
- }else{
- if(/constructor/i.test(window.HTMLElement) || (function(p){return p.toString() === '[object SafariRemoteNotification]';}) (!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification))){
- var safariBlob = new Blob([blob],{type:'application/pdf'});
- window.saveAs(safariBlob,stmtCde);
- }else{
- var link = window.URL.createObjectURL(blob);
- window.open(link,'');
- }
- }
- }, function (error) {
- console.log(error);
- });
复制代码 |