jsPDF使用downloadify包括一个不工作的图像
jsPDF using downloadify including an image not working
以下是代码:
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行,它就可以正常工作。想法?谢谢
终于拿到了。
为图像添加了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
});
相关文章:
- 引导程序转盘不工作:堆叠图像(使用rails)
- 单击水平滚动库中的图像以居中显示无法工作的功能
- 图像翻转脚本未按预期工作
- 在页面中使用了两次多个图像上传,但第一个正在工作,另一个不起作用
- JQuery图像预览无法工作
- 弹出图像无法使用jquery在html中工作
- JQuery图像滑块和CSS转换只能工作一次
- 卷轴上的视差图像和粘滞标题无法正常工作
- 图像占位符没有't的工作原理与Angular 1中的相同
- 图像看起来像一个只在firefox中工作的按钮
- flexislider无法在现场工作,图像没有旋转,但导航点正在改变
- 更改图像src-dons't工作jquery/js
- JQuery图像大小计算没有'不能在Chrome/Safari中工作
- Fancybox图像点击可以独立工作,但不能与我的其他代码一起工作
- 谷歌图书预览没有在安全的https上显示图书图像链接,但在http上工作.在Google Chrome和Touch浏览器
- Elastislide-如何使其在不同的图像宽度下工作
- Jquery只有在加载图像后才能使fadeIn工作
- 在执行 h:命令链接操作时显示工作图像
- 为什么这个jQuery不能工作?图像淡出和淡出
- Flexslider-如何使用单个方向Nav使两个滑块一起工作(图像和段落文本)