我正在尝试使jspdf正常工作。单击我的小提琴中的按钮后没有任何反应。这是jsfiddlehttps://jsfiddle.net/light22/68h81owf/)。在此先感谢您的帮助。

这是我正在使用的脚本:

<script>
    function demoFromHTML() {
        var pdf = new jsPDF('p', 'pt', 'letter');

        source = $('#for_pdf')[0];

        specialElementHandlers = {

            '#bypassme': function (element, renderer) {
                return true
            }
        };
        margins = {
            top: 80,
            bottom: 60,
            left: 40,
            width: 522
        };

        pdf.fromHTML(
            source,
            margins.left,
            margins.top, {
                'width': margins.width,
                'elementHandlers': specialElementHandlers
            },

            function (dispose) {

                pdf.save('download.pdf');
            }, margins
        );
    }
</script>

最佳答案

单击jsfiddle中的按钮后,将引发错误:ReferenceError: demoFromHTML is not defined。您还忘记了关闭<table>中的style属性

关于javascript - 需要帮助获取jspdf以便将html呈现为PDF,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42549436/

10-09 05:59