html2canvas rendering Dom problem

html2canvas renders DOM into canvas and then generates images;

During use, it was discovered that the rendering of an iframe outside the dom was triggered. Since the iframe was used to download files in the project, the files on the iframe would be re-downloaded.

After checking some information, I found that although it only renders part of the dom you passed, html2canvas will load js, css and iframe outside the dom.

This is a problem. I need to solve it. Then I looked for information and found that html2canvas needs to exclude elements from rendering. Just add the attribute data-html2canvas-ignore='true' to the element and that's it!

<iframe src="https://xxxxx.doc" data-html2canvas-ignore='true'></iframe>

Guess you like

Origin blog.csdn.net/chen548246/article/details/106786312