我有这个代码,使用jsPDF将html转换为pdfs。它在chrome和firefox中运行得很好,但是在safari中测试它时,我收到了这样的消息:error in function: '[object BlobConstructor]' is not a constructor
。这是我的代码:
var doc = new jsPDF("p", "pt", "letter");
$(document).ready(function ()
{
$("#runpdf").click(function (event)
{
$(document.body).width(1903);
var count=0;
$("section").each(function()
{
$(this).children('footer').children('article').append($(document.createElement('span')).text((count+1)+".").css("float","right").css("font-weight", "900").css("font-size","150%"));
count++;
});
var pages = $(".page5");
var remaining = pages.length;
pages.each(function ()
{
html2canvas($(this),
{
logging: true,
profile: true,
allowTaint: true,
letterRendering: true,
onrendered: function (canvas)
{
var imageData = canvas.toDataURL("image/jpeg");
doc.addImage(imageData, 'JPEG', -425, 0, 1450, 800);
remaining--;
if (remaining === 0)
{
doc.save('test.pdf');
}
doc.addPage();
}
});
});
});
});
有关如何修复此Safari问题的任何想法?提前致谢