loadPDF() {
const drName = localStorage.getItem('userInfo');
this.getQueryParams();
this.desiredDate = new Date(this.value);
const r = new Date(this.desiredDate.getFullYear(),
this.desiredDate.getMonth(), this.desiredDate.getDate());
const sDate = `${r.getMonth() + 1}-${r.getDate()}-${r.getFullYear()}`;
let doc = new jsPDF('p', 'pt', 'a4');
h2c(document.getElementById('mybarchart')).then(function (canvas) {
let width = doc.internal.pageSize.getWidth();
let height = doc.internal.pageSize.getHeight();
let dataURL = canvas.toDataURL('image/jpeg', 1.0);
doc.addImage(dataURL, 'jpg', 0, 0, width, height, 'none');
const name = drName.replace(' ', '_');
localStorage.removeItem('PrintReport');
doc.save(`${sDate}` + `-` + `${name}`+`.pdf`);
document.getElementById("pdfLoader").classList.remove('loader');
window.close();
});
}
我下载了pdf页面,但是它不支持某些浏览器,例如firefox和Microsoft edge,这意味着pdf在该浏览器中没有以角度下载