'Content Is Not fitting in jsPDF

I am using JsPDf to convert html dom element to pdf but afterg generating PDf. The size of the PDF is adding extra space and make it smaller. Please Check the link to get more details.

  const _generatePdf = ()=>{
    // var [width , height] = size
    var page_el = document.getElementById("doc")
    var width = page_el.clientWidth* (96/72)
    var height = page_el.clientHeight * (96/72)

    // console.log(page_el.offsetWidth*(96/72), width)
    var doc = new jsPDF({
      orientation:"l",
      unit:"pt",
      format:[height, width],
    })
    console.log(doc.internal.pageSize.getWidth(), width)
    console.log(doc.internal.pageSize.getHeight(), height)
    
    doc.html(document.querySelector("#page"),{
      callback:function(pdf){
        // console.log(pdf)
        pdf.save("mypdf.pdf")
      }, 
      html2canvas:{
        scale:1
      } 

    })
  }

Result I am Getting

Result I want



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source