如何将表格html表格导出为PDF? [英] how to export table html table to PDF?

查看:728
本文介绍了如何将表格html表格导出为PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经尝试使用:
-itext到后端(java),但是我们需要一个关于将DIV导出为PDF的帮助。未呈现CSS;
-html2canvas转换DIV图像和JSPDF以将图像添加到PDF,此方案funcinou但仅适用于google chorme和IE 11,而且我还需要在IE 9& 10.任何提示?

解决方案

有一个名为 jsPDF 这是客户端的PDF文件。他们也有示例,演示如何使用该库。他们有一个名为addHTML()的例子,它可能是你正在寻找的。

在你的情况下,你可能想要这样做:

  pdf.addHTML(document.getElementById('DIV_ID'),function(){
var string = pdf.output('datauristring') ;
$('。preview-pane')。attr('src',string);
});

在示例页面上,他们写道IE6 +,Firefox 3 +,Chrome,Safara 3+和Opera应该工作。

I need a help regarding the export of a DIV to PDF.

I already tried to use : -itext to the backend ( java ) but not rendered CSS ; -html2canvas to transform the DIV image and JSPDF to add the image to PDF , this scheme funcinou but only for google chorme and IE 11 , and I need to work also in IE 9 & 10. Any tips ?

解决方案

There is a Javascript library called jsPDF which is PDF files on client side. They also have examples that demonstrates how to use the library. They have an example called addHTML() which might be what you are looking for.

In your case you might want to do something like this:

pdf.addHTML(document.getElementById('DIV_ID'),function() {
    var string = pdf.output('datauristring');
    $('.preview-pane').attr('src', string);
});

On the examples page they write that IE6+, Firefox 3+, Chrome, Safara 3+ and Opera should work.

这篇关于如何将表格html表格导出为PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆