【发布时间】:2014-11-24 00:49:32
【问题描述】:
我创建了一个下载pdf 的应用程序。 pdf 基于 html 表。
该应用程序在所有浏览器中都运行良好,但是当我在 IE9 中运行时,我得到了Error in function : 'ArrayBuffer' is undefined ReferenceError: 'ArrayBuffer' is undefined。由于 IE9 是基于 HTML5 的浏览器,我猜 jspdf 应该可以工作。
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
pdf.cellInitialize();
pdf.setFontSize(10);
$.each($('#customers tr'), function (i, row) {
if ($(row).text().trim().length !== 0) {
$.each($(row).find("td, th"), function (j, cell) {
var txt = $(cell).text().trim() || " ";
var width = (j == 4) ? 40 : 70;
if (j == 7) {
width = 120;
}
if(i==0)
{
pdf.setFontStyle('bold');
}
else
{
pdf.setFontStyle('normal');
}
pdf.cell(10, 10, width, 18, txt, i);
});
}
});
pdf.save('sample-file.pdf');
}
谁能告诉我一些解决方法
【问题讨论】:
-
"Browser Compatibility jsPDF 可以在 IE6+*, Firefox 3+, Chrome, Safari 3+, Opera 中运行。对于 IE9 及以下,我们懒加载 Flash名为 Downloadify 的 shim 可以下载文件。(当前版本未启用 IE6-9 shim)。" -jsPDF page
-
那么我需要做什么
-
我不知道,也许启用 shim?
-
如何为 IE9 启用 shim
标签: javascript jquery html internet-explorer-9 jspdf