0

I would create a PDF-Document with a table and it works, but the table is to long for one page, how can I 'cut' the table in two? Means the first 60 rows of table on page one and the next 100 on page two. The code (reduced):

function createDoc() {
 [...]
    pdf.addHTML(document.getElementById('svg_graph'), 20, 110, function () {
    pdf.addPage();
    pdf.addHTML(document.getElementById('table'), 40, 40, function () {
    pdf.save('AjaxReport-' + curNum + '.pdf'); });
    });
};

curNum is a string.

Jessi914
  • 3
  • 1
  • 2

1 Answers1

1

You can use the "pagesplit" option and new pages will be automatically added as needed.

Taking your example, it'd be:

function createDoc() {
[...]
  var options = { pagesplit : true };

  pdf.addHTML(document.getElementById('svg_graph'), 20, 110, function ()
  {
    pdf.addPage();
    pdf.addHTML(document.getElementById('table'), 40, 40, options, function ()
    {
       pdf.save('AjaxReport-' + curNum + '.pdf'); });
    });
  });
};
diegocr
  • 1,000
  • 8
  • 13
  • Thanks. Now it's divided into several pages, but the quality of the writing has reduced and it's hardly readable. Do you have an idea how I can manage this? – Jessi914 Sep 18 '14 at 12:31
  • See http://stackoverflow.com/questions/25904440/jspdf-addhtml-multiple-canvas-page/25907361?noredirect=1#comment40554997_25907361 – diegocr Sep 18 '14 at 12:45