Page split is not working in jsPDF

不羁岁月 提交于 2019-12-12 03:54:56

问题


I have some content on my page and also have three C3 graphs I am using jsPDF to generate the pdf with graphs.

My code:

$(function() {
    $('#download_as_pdf').click(function() {
        var pdf = new jsPDF('lanscape');
        var options = { pagesplit: true,'background': '#fff' };
        pdf.addHTML($('#customer_report_section'), options, function() {
            pdf.save("mypdf.pdf");
        });
    });
});

Now its working fine and pdf is generating but PDF has 5-6 pages they are not breaking properly. Anyone have any idea how can I achieve this?


回答1:


I haven't seen any option that works properly (check this issue on Github: https://github.com/MrRio/jsPDF/issues/944)

There's this package that promises to fix some of the issues, but I haven't tried it yet: https://github.com/MrRio/jsPDF/issues/1176

The last option I see is splitting your content into different pages manually and adding a page after each, sort of like this: https://github.com/MrRio/jsPDF/issues/46#issuecomment-205510431



来源:https://stackoverflow.com/questions/44538408/page-split-is-not-working-in-jspdf

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