Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- html2canvas(document.body, {
- // Scale image for better quality
- scale: 5,
- dpi: 300,
- onrendered: function (canvas) {
- // Convert image to dataURL
- const image = canvas.toDataURL("image/png");
- // Save dataURL in session storage
- try {
- window.sessionStorage.setObject(new Date().getTime(), image);
- document.getElementById('status').innerHTML = "Aktuelle Kennzahl erfolgreich hinzugefügt!"
- } catch (error) {
- console.log(error);
- document.getElementById('status').innerHTML = "Fehler beim Hinzufügen der Kennzahl!"
- }
- }
- });
- let doc = new jsPDF('p', 'mm', 'a4');
- // Set image width to a4
- const width = doc.internal.pageSize.getWidth();
- const height = doc.internal.pageSize.getHeight();
- doc.addImage(image, 'PNG', 0, 0, width, height * 0.65, '', 'SLOW');
- doc.addPage();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement