Relative Content

Tag Archive for javascripthtmldom-to-image

dom-to-image.js not capturing text div

<!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1.0, user-scalable=no”> <title>Test</title> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/html-to-image.min.js”></script> <link rel=”stylesheet” href=”stylesheet.css”> </head> <body> <div class=”nameText”> <div class=”text outline”> <span>A</span> <span>B</span> </div> </div> <button id=”capture”>screenshot</button> <div id=”output”></div> <script type=”module” src=”javascript.js”></script> </body> </html> document.getElementById(‘capture’).addEventListener(‘click’, function() { var node = document.querySelector(‘.nameText’); domtoimage.toPng(node) .then(function(dataUrl) { var outputDiv = document.getElementById(‘output’); outputDiv.innerHTML = ‘<img […]

dom-to-image.js not capturing span div

<!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1.0, user-scalable=no”> <title>Test</title> <script src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/html-to-image.min.js”></script> <link rel=”stylesheet” href=”stylesheet.css”> </head> <body> <div class=”nameText”> <div class=”text outline”> <span>A</span> <span>B</span> </div> </div> <button id=”capture”>screenshot</button> <div id=”output”></div> <script type=”module” src=”javascript.js”></script> </body> </html> document.getElementById(‘capture’).addEventListener(‘click’, function() { var node = document.querySelector(‘.nameText’); domtoimage.toPng(node) .then(function(dataUrl) { var outputDiv = document.getElementById(‘output’); outputDiv.innerHTML = ‘<img […]