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 bee 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)
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 bee 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)
Share Improve this question asked Apr 20, 2017 at 2:58 NexzNexz 931 silver badge10 bronze badges 2- Please provide a Minimal, Complete, and Verifiable example. What code have you tried? – Ricky Ruiz Commented Apr 20, 2017 at 5:51
- @Ricky jspdf is a plugin,not my own coding. – Nexz Commented Apr 20, 2017 at 6:01
2 Answers
Reset to default 5You 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.
You can use dimensions for jsPDF directly from canvas object like described there https://stackoverflow./a/65124814/9026103.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744269486a4566029.html
评论列表(0条)