Hello, I need to open PDF from my table on the click button, it is working in all browsers, except in IE, at first it's just convert base64 to something that IE supports, automatic, via javascript, but that's not what I am getting it.
This is my JS
gerarRelatorio = function() {
var doc = new jsPDF('l', 'pt');
var res = doc.autoTableHtmlToJson(document
.getElementById("tabela"));
var header = function(data) {
doc.setTextColor(40);
doc.setFontStyle('normal');
doc.setFontSize(11);
};
var options = {
addPageContent : header,
theme : 'striped',
tableWidth : 'auto',
margin : {
top : 80
},
startY : false
};
doc.autoTable(res.columns, res.data, options);
var data = doc.output('dataurl');
var fileName = "pdf.pdf";
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
var byteCharacters = atob('dataurl');
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var blob = new Blob([byteArray], {type: 'application/pdf'});
var base64EncodedPDF = data;
var dataURI = "data:application/pdf;base64," + data;
window.open(dataURI, '_blank');
window.navigator.msSaveOrOpenBlob(blob, fileName);
window.open("data:application/pdf;base64, " + dados, '',
"height=600,width=800");
}
else {
x = window.open();
iframe = x.document.createElement('iframe')
iframe.width = '100%'
iframe.height = '100%'
iframe.frameBorder = 0
dados = doc.output('dataurl');
iframe.style = "border: 0"
iframe.src = 'data:application/pdf;base64' + dados
x.document.body.appendChild(iframe);
}
}