Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用jsPDF将HTML表格导出为PDF格式_Javascript_Php_Html_Export_Jspdf - Fatal编程技术网

Javascript 使用jsPDF将HTML表格导出为PDF格式

Javascript 使用jsPDF将HTML表格导出为PDF格式,javascript,php,html,export,jspdf,Javascript,Php,Html,Export,Jspdf,我正在使用jspdf将表格从html导出为PDF,但是我的表格看起来很混乱: 这是我的html表格: 最后,这是我的代码: function demoFromHTML() { var pdf = new jsPDF('p', 'pt', 'letter'); source = jQuery('#customers')[0]; specialElementHandlers = { // element with id of "bypass" - jQu

我正在使用jspdf将表格从html导出为PDF,但是我的表格看起来很混乱:

这是我的html表格:

最后,这是我的代码:

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

    source = jQuery('#customers')[0];

    specialElementHandlers = {
        // element with id of "bypass" - jQuery style selector
        '#bypassme': function(element, renderer) {
            // true = "handled elsewhere, bypass text extraction"
            return true
        }
    };
    margins = {
        top: 30,
        bottom: 60,
        left: 60,
        width: 700
    };

    pdf.fromHTML(
            source, 
            margins.left, 
            margins.top, {
                'width': margins.width, 
                'elementHandlers': specialElementHandlers
            },
    function(dispose) {
        pdf.save('Test.pdf');
    }
    , margins);
}
我真的很困惑为什么它不能正常工作,我已经尝试了很多东西,但似乎这只能通过jspdf文档来解决,而在导出表时,jspdf文档几乎是不存在的,我真的很绝望,任何帮助都是感谢的


谢谢:)

您对HTML是否有效有多大把握?