How to remove certain elements before taking screenshot?
Add this attribute: data-html2canvas-ignore to any element you don’t want to be taken when the screenshot is processed. Hopefully this will help the next guy.
Add this attribute: data-html2canvas-ignore to any element you don’t want to be taken when the screenshot is processed. Hopefully this will help the next guy.
you can use scale options in html2canvas. In the latest release, v1.0.0-alpha.1, you can use the scale option to increase the resolution (scale: 2 will double the resolution from the default 96dpi). // Create a canvas with double-resolution. html2canvas(element, { scale: 2, onrendered: myRenderFunction }); // Create a canvas with 144 dpi (1.5x resolution). html2canvas(element, … Read more
NOTE: this answer is from 2015 and the library has been updated. Check the answers below for alternate implementations. Try this (Note that it makes use of the download attribute. See the caniuse support table for browsers that support the download attribute) <script> $(‘#save_image_locally’).click(function(){ html2canvas($(‘#imagesave’), { onrendered: function (canvas) { var a = document.createElement(‘a’); // … Read more
Package installed by npm is located in /node_modules/ which cannot be used by front end directly. To use those modules, you need to use ES6 syntax and import them by using the following code: // Just an example, you need to read the doc to see how to import import html2cavas from “html2cavas” However, browser … Read more
I ran into the same type of error you described, but mine was due to the dom not being completely ready to go. I tested with both jQuery pulling the div and also getElementById just to make sure there wasn’t something strange with the jQuery selector. Below is an example that works in Chrome: <html> … Read more
You can use jspdf. working Demo .html <div id=”pdfTable” #pdfTable> <h1>{{name}}</h1> <table> <tr> <th>Company</th> <th>Contact</th> <th>Country</th> </tr> <tr> <td>Alfreds Futterkiste</td> <td>Maria Anders</td> <td>Germany</td> </tr> <tr> <td>Centro comercial Moctezuma</td> <td>Francisco Chang</td> <td>Mexico</td> </tr> <tr> <td>Ernst Handel</td> <td>Roland Mendel</td> <td>Austria</td> </tr> <tr> <td>Island Trading</td> <td>Helen Bennett</td> <td>UK</td> </tr> <tr> <td>Laughing Bacchus Winecellars</td> <td>Yoshi Tannamuri</td> <td>Canada</td> </tr> <tr> … Read more
I hope thet help you html2canvas(htmlSource, {scrollY: -window.scrollY}).then(function(canvas) { var img = canvas.toDataURL(); window.open(img); });
JavaScript can read the DOM and render a fairly accurate representation of that using canvas. I have been working on a script which converts HTML into a canvas image. Decided today to make an implementation of it into sending feedbacks like you described. The script allows you to create feedback forms which include a screenshot, … Read more