2017-11-23 7 views
0

jsPDFを使用して、そのクラスからHTMLテーブルをPDFに印刷しようとしていますが、テーブルから間違ったサイズを取得しています。それを修正する方法はありますか、私は何か間違っていますか?jsPDFを使用してテーブルのフルサイズのHTMLテーブルから正しくPDFを生成するには

Full Table

PDF Generated

私の.jsは、PDFを生成する機能である:幅522:

$scope.demoFromHTML = function() { 
    var pdf = new jsPDF('l', 'pt', 'a4', true); 
    // source can be HTML-formatted string, or a reference 
    // to an actual DOM element from which the text will be scraped. 
    var source = $('#content')[0]; 

    // we support special element handlers. Register them with jQuery-style 
    // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.) 
    // There is no support for any other type of selectors 
    // (class, of compound) at this time. 
    var specialElementHandlers = { 
     // element with id of "bypass" - jQuery style selector 
     '#bypassme': function (element, renderer) { 
      // true = "handled elsewhere, bypass text extraction" 
      return true 
     } 
    }; 
    var margins = { 
     top: 80, 
     bottom: 60, 
     left: 40, 
     width: 522 
    }; 
    // all coords and widths are in jsPDF instance's declared units 
    // 'inches' in this case 
    pdf.fromHTML(
     source, // HTML string or DOM elem ref. 
     source.left, // x coord 
     source.top, { // y coord 
      'width': source.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 
      pdf.save('Test.pdf'); 
     }, margins 
    ); 
} 

答えて

0

あなたは幅を変更してみました余白のオブジェクトでsource.width?

+0

はい、変更はありません。 –

関連する問題