Search code examples
javascriptjspdfhtml2pdf

jspdf, add new page, coordinates


I am using jspdf for html to pdf conversion.

First page is rendering the content perfectly. But when it comes to second page, when I use doc.cell(10, 10, cellWidth, 10, txt, j); it is displaying in the middle of the page instead to appear at the start.

If I use doc.text(10.10,"value") its appearing at the right coordinates.

Please help me.


Solution

  • To add the contents to another page simply do

    doc.addPage() 
    

    Example suppose you have two pages

     doc.text(10.10,"value")  //this will bne in the first page
    
     docaddPage() //this adds another page
    
     doc.text(10.10,"value") // this will be in page2