title: JSPDF shift to new page when Data is full in page
body: <p>I am new in JSPDF and creating a page of PDF like this <a href="https://i.stack.imgur.com/1l3HC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1l3HC.png" alt="Lable view of data"></a> Now Problem is that when data is full on this page it didn't produce new page. I have that <a href="https://github.com/MrRio/jsPDF/issues/101" rel="nofollow noreferrer">github</a> and other solutions on stack overflow. but not getting solution. 
  [JSPDF demo link is here][3]</p>
  
  <p>[3]: > <a href="https://jsfiddle.net/jodfkz59/7/" rel="nofollow noreferrer">https://jsfiddle.net/jodfkz59/7/</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var data = [{
        "Name": "Ronan",
        "Email": "sodales.elit@eratSed.co.uk",
        "Company": "Malesuada Malesuada Ltd"
      }, {
        "Name": "Calvin",
        "Email": "amet.nulla@Vestibulumante.ca",
        "Company": "Donec Egestas Foundation"
      }, {
        "Name": "Kane",
        "Email": "Duis.mi@consectetueradipiscingelit.net",
        "Company": "Arcu Institute"
      }, {
        "Name": "Kasper",
        "Email": "magna.Phasellus.dolor@velconvallisin.co.uk",
        "Company": "Tempor LLP"
      }];
      
      
      var doc = new jsPDF('p', 'pt', 'a4');
      //Dimension of A4 in pts: 595 × 842
      
      var pageWidth = 595;
      var pageHeight = 842;
      var y=500;
      var pageMargin = 10;
      
      pageWidth -= pageMargin * 2;
      pageHeight -= pageMargin * 2;
      
      var cellMargin = 5;
      var cellWidth = 250;
      var cellHeight = 60;
      
      var startX = pageMargin;
      var startY = pageMargin;
      
      function createCard(item) {
      
        // doc.getTextDimensions(item.Name); turncate or split string if you needed
        
      if (y &gt;= pageHeight)
  {
    doc.addPage();
    y = 0 // Restart height position
  }
      
        doc.text(item.Name, startX, startY);
        doc.text(item.Email, startX, startY + 20);
        doc.text(item.Company, startX, startY + 40);
      
        var nextPosX = startX + cellWidth + cellMargin;
      
        if (nextPosX &gt; pageWidth) {
          startX = pageMargin;
          startY += cellHeight;
        } else {
          startX = nextPosX;
        }
      
      }
      
      
      for (var i = 0; i &lt; data.length; i++) {
        createCard(data[i]);
      }</code></pre>
  </div>
  </div>
  </p>