Export HTML + CSS to PDF using Javascript

馋奶兔 提交于 2019-12-13 02:18:26

问题


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>

but it doesn't support CSS .. how can I export it with its style ?


回答1:


What data do you want to export?

If you want to export an HTML <table>, you can take a look at this export sample provided by the Shield UI Grid widget.



来源:https://stackoverflow.com/questions/37369661/export-html-css-to-pdf-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!