本文介绍了分页在jsPDF中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有一些内容,还有三张C3图形,我正在使用jsPDF生成带有图形的pdf.

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

我的代码:

$(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");
        });
    });
});

现在可以正常工作了,并且正在生成pdf,但是PDF有5-6页,它们无法正常断开.任何人都知道我该如何实现?

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?

推荐答案

我没有看到任何可以正常工作的选项(在Github上检查此问题: https://github.com/MrRio/jsPDF/issues/944 )

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

有一个可以保证解决某些问题的软件包,但是我还没有尝试过: https://github.com/MrRio/jsPDF/issues/1176

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

我看到的最后一个选择是将您的内容手动分成不同的页面,并在每个页面之后添加一个页面,如下所示: https://github.com/MrRio/jsPDF/issues/46#issuecomment-205510431

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

这篇关于分页在jsPDF中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 13:14