-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add image without distorting ratio #3401
Comments
Hi @mednche, I haven't seen this kind of functionality in jsPDF but in cases like yours I use this formula, using html2canvas:
Also make sure u are using the correct units. |
Thanks for your reply @JobSoltero! Can you explain a bit more what |
Yeah it uses an html as input and then converts it into an Image. For your case u can directly use the Image url
|
@mednche Do you have any update in this bug? |
Thanks for your answer @JobSoltero! It helped me find a solution. I didn't know about |
Great!, I guess this issue can be closed now |
"I have read and understood the contribution guidelines."
I am trying to add an image (dataURL format) to my PDF to fit in a 65*60 mm box.
My current code is:
However I get a distorted image as below, which doesn't respect the aspect ratio of the original image.
My images are already in the correct dimensions to fit in the box (see below for the correct ratio) so I'd like to be able to add them to the PDF without enforcing a width and height.
Alternatively, is there a way to specify a resize mode for my image (e.g. 'contain')?
The text was updated successfully, but these errors were encountered: