I have a problem with my project, and it is about converting the html file to pdf. I have one question, how can we alter the size of image in jspdf because when i'm downloading the pdf, it show that the image is not fit in the page and only show half of it for A4.then, i'm trying using the A0 size but the font will become very small even though the image is right. can some one tell how to fit the image or maybe changing the font size? (and also i'm using HTMLfromPdf.js)
Asked
Active
Viewed 8,364 times
1
-
Please provide a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). What code have you tried? – Ricky Ruiz Apr 20 '17 at 05:51
-
@Ricky jspdf is a plugin,not my own coding. – Nexz Apr 20 '17 at 06:01
2 Answers
5
You can resize the canvas image using the method parameters,
pdf.addImage(imgData,'JPEG',0,0,canvas.width*0.2,canvas.height*0.2,"a","FAST");
You can calculate the required ratio and replace the image width and height parameters.

Senuri De Silva
- 112
- 1
- 5
0
You can use dimensions for jsPDF directly from canvas object like described there https://stackoverflow.com/a/65124814/9026103.

Igor Kurkov
- 4,318
- 2
- 30
- 31