Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jspdf addHTML pagesplit option is stretching the pages

I have tried everything on internet and this is my last try to find if this is possible or not. What I am dealing with is a long and dynamic html and I have to convert it to multi page pdf. I had tried both addhtml and addImage methods but didn't got the desired result.

addhtml: when I used pagesplit option its stretching all the pages. I tried giving width and height in options too but than it stopped displaying.

addimage: this is only showing image on 1 page no option to split the image on 2 pages either.

One more thing I want to add is my html can have dynamic width and height too.

Note: I am using jspdf and html2canvas libraries

like image 436
Ajay Gunpal Avatar asked Sep 23 '15 10:09

Ajay Gunpal


1 Answers

check this issue: https://github.com/MrRio/jsPDF/issues/707

You should be able to solve this by modifying the scale factor.

var pdf = new jsPDF('p', 'pt', 'letter');
pdf.internal.scaleFactor = 2.25;

Cheers,

like image 156
jaumebalust Avatar answered Nov 08 '22 01:11

jaumebalust