本文介绍了使用Javascript将HTML + CSS导出为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将一部分html代码导出为pdf,为此,我正在使用以下代码:
I want to export a part of my html code to pdf, for this I am using the following code :
<script language = "JAVASCRIPT">
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#download').click(function () {
doc.fromHTML($('#mytable').html(), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
});
</script>
但是它不支持CSS ..如何导出其样式?
but it doesn't support CSS .. how can I export it with its style ?
推荐答案
您要导出哪些数据?
如果要导出HTML <table>
,可以查看此导出示例由Shield UI Grid小部件提供.
If you want to export an HTML <table>
, you can take a look at this export sample provided by the Shield UI Grid widget.
这篇关于使用Javascript将HTML + CSS导出为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!