I want to create a pdf of div and then want to print that pdf.
Inside div there is two div 1st div contents table 2nd div contents image.
<div id="printableDiv">
<div id="1st">
<table>
</table>
</div>
<div id="2nd">
<img>
</div>
</div>
I tried with below code
var imgData = canvas.toDataURL("image/jpeg", 1.0);
var pdf = new jsPDF('p', 'pt', 'a4');
var width = pdf.internal.pageSize.getWidth();
var height = pdf.internal.pageSize.getHeight();
pdf.addImage(imgData, 'JPG', 10, 10, width, height);
for (var i = 1; i <= totalPDFPages; i++) {
pdf.addPage(PDF_Width, PDF_Height);
pdf.addImage(imgData, 'JPG', top_left_margin, -(PDF_Height * i) + (top_left_margin * 4), canvas_image_width, canvas_image_height);
}
but here it will create a jpeg image and then add it to pdf,
but I want to add html content directly to pdf.
Thanks in advance