We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
when generating an image, the image appears cropped, adding width property helps but still cropped
const container = document.getElementById("container"); domtoimage .toPng(container, { width: 490, }) .then(function (dataUrl) { let img = document.createElement("img"); img.src = dataUrl; document.body.appendChild(img); });
Note, height property seems to do nothing at least in Firefox
height
Firefox
This is a Chrome screenshot
width
3.2.0
The text was updated successfully, but these errors were encountered:
Had the same problem in Firefox. Scaling up the image this way (not using the scale property in the options parameter) should fix it for you:
var scale = 2; // make this whatever you want var dataUrl = await domtoimage.toJpeg(node, { width: node.clientWidth * scale, height: node.clientHeight * scale, style: { transform: "scale(" + scale + ")", transformOrigin: "top left" } }); var img = new Image(); img.src = dataUrl; document.body.appendChild(img);
Sorry, something went wrong.
Thanks @Josh961 - this works perfectly!
I believed I had responded to this, but yes, it works perfectly! Thank you so much @Josh961!!!
No branches or pull requests
Use case: description, code
when generating an image, the image appears cropped, adding width property helps but still cropped
Expected behavior
Actual behavior (stack traces, console logs etc)
With
width
propertyWithout
Library version
3.2.0
Browsers
The text was updated successfully, but these errors were encountered: