簡體   English   中英

需要幫助讓jspdf將html呈現為PDF

[英]Need help getting jspdf to render html to PDF

我想讓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屬性

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM