HTML to Canvas conversion is not performing for dynamic nested DOM objects.
sthirunavukarasu opened this issue · comments
HTML to canvas is not working as expected for the dynamic DOM objects without any issue.
Expected Behavior
When use toCanvas method from this library the dynamic dom objects not getting converted as we expected and also for the nested HTML elements are not getting rendered with proper css styles there was some sort issue of applying the styles into those converted HTML to Canvas objects.
When use toCanvas method from this library it has convert Canvas into deepest level of HTML along with respective css styes which is applied to those elments.
Current Behavior
![Screenshot 2024-05-02 at 8 06 26 PM](https://private-user-images.githubusercontent.com/101827188/328029186-32c27fba-f811-495c-b331-907e67d08f88.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI2NjQyNjQsIm5iZiI6MTcyMjY2Mzk2NCwicGF0aCI6Ii8xMDE4MjcxODgvMzI4MDI5MTg2LTMyYzI3ZmJhLWY4MTEtNDk1Yy1iMzMxLTkwN2U2N2QwOGY4OC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODAzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwM1QwNTQ2MDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kOGM4YTQ5ZTlkNjhkNmU1MGI0NTdmOGJkMDM2NjZmZWEyMTA3MWQ0MWIxNjU4NDc2ZjIwMGRhZDExMzdjYzhiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.sNnB773wn14zd-sVWM6eTgHYKJfiL9WEiaG2vQ-MV2Q)
Possible Solution
When we convert HTML to canvas it has to convert Nested DOM objects into deeper level along with defined css styles.
Steps To Reproduce
demo_clip.mp4
code example
const screenshot = await htmlToImage.toCanvas(pdftronUI, {
canvasWidth: this.canvas.height,
canvasHeight: this.canvas.height,
width: this.canvas.width,
height: this.canvas.height,
});
No Error
<!-- Provide a log message if relevant -->
Additional Context
Your Environment
Front-end: React JS
Backend: .Net
- html-to-image: 1.8.0
- OS: Mac and Windows
- Browser: Chrome Browser
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.