我们在JSPDF中拥有正确的保证金属性吗?

时间:2018-11-05 17:43:31

标签: javascript jspdf

我们在JSPDF中是否拥有正确的保证金属性?就我而言,它不起作用。左下角的top属性在起作用,只有右边距不起作用。

    var pdf = new jsPDF('p', 'pt', 'letter');
    //var pdf = new jsPDF();

    source = $('#PDFContent').html();

    specialElementHandlers = {
        // element with id of "bypass" - jQuery style selector
        '#bypassme' : function(element, renderer) {
            // true = "handled elsewhere, bypass text extraction"
            return true
        }
    };

    margins = {
        top : 5,
        right: 10,
        bottom : 60,
        left : 10,
        width : 700
    };

    pdf.fromHTML(source, // HTML string or DOM elem ref.
    margins.left, // x coord
    margins.top, { // y coord
        'width' : margins.width, // max width of content on PDF
        'elementHandlers' : specialElementHandlers
    },

    function(dispose) {
        // dispose: object with X, Y of the last line add to the PDF 
        //          this allow the insertion of new lines after html
        headerFooterFormatting(pdf, pdf.internal.getNumberOfPages());
        pdf.save('Test.pdf');
    }, margins);

0 个答案:

没有答案