2017-11-23 1 views
0

jsPDF를 사용하여 HTML 표를 PDF로 인쇄하려고하는데 표에서 크기가 잘못되었습니다. 그 문제를 해결할 수있는 방법이 있습니까? 아니면 제가 잘못하고있는 것입니까?jsPDF를 사용하여 표 전체 크기의 HTML 표에서 PDF를 정확하게 생성하는 방법

Full Table

PDF Generated

내의 .js는 PDF가 생성하는 기능 : 522 폭 : 마진 객체의 source.width를

$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

당신이 변화 폭을 시도 했습니까?

+0

예, 변경 사항 없음 /. –

관련 문제