2016-02-17 30 views

回答

-1
openPDF(data, "DataSheet.pdf");//data is your bytearray intead of pdf try to ur file format 

// ... 

function openPDF(resData, fileName) { 
    var ieEDGE = navigator.userAgent.match(/Edge/g); 
    var ie = navigator.userAgent.match(/.NET/g); // IE 11+ 
    var oldIE = navigator.userAgent.match(/MSIE/g); 

    var blob = new $window.Blob([resData], { 
     type: 'application/pdf' 
    }); 

    if (ie || oldIE || ieEDGE) { 
     $window.navigator.msSaveBlob(blob, fileName); 
    } else { 

     var file = new Blob([resData], { 
      type: 'application/pdf' 
     }); 
     var fileURL = URL.createObjectURL(file); 

     $window.open(fileURL); 
    } 
} 
相關問題