代码如下:
Downloadify.create('downloadify',{
filename: 'Example.pdf',
data: function(){
var doc = new jsPDF();
doc.setFontSize(40);
doc.text(35, 25, "Octonyan loves jsPDF");
doc.addImage(imgData, 'JPEG', 15, 40, 180, 180);
return doc.output();
},
onComplete: function(){ alert('Your File Has Been Saved!'); },
onCancel: function(){ alert('You have cancelled the saving of this file.'); },
onError: function(){ alert('Error'); },
swf: 'Downloadify/media/downloadify.swf',
downloadImage: 'Downloadify/images/save.png',
width: 250,
height: 40,
transparent: true,
append: false
});目标浏览器为IE8。我使用的是来自jsPDF.com的图像示例。如果我删除doc.addImage行,它就能正常工作。想法?谢谢。
发布于 2013-07-19 02:27:55
终于明白了。
增加镜像的dataType: 'base64',并修改data: function()。
以下是我的工作代码:
Downloadify.create('downloadify',{
filename: 'Example.pdf',
dataType: 'base64',
data: function(){
var doc = new jsPDF();
doc.addImage(img64, 'JPEG', 0, 0, 215, 40);
var output = doc.output();
return btoa(output);
},
onComplete: function(){ alert('Your File Has Been Saved!'); },
onCancel: function(){ alert('You have cancelled the saving of this file.'); },
onError: function(){ alert('Error'); },
swf: 'Downloadify/media/downloadify.swf',
downloadImage: 'Downloadify/images/save.png',
width: 250,
height: 40,
transparent: true,
append: false
});https://stackoverflow.com/questions/17729525
复制相似问题