Hey, sorry for the delay (i got sick and only now got the chance to try this) Thanks! I tried a few diferent ways to implement this, but it took me awhile to realise that it does indeed work, but only in chrome....? It's suposed to work in all browsers, right? I don't know why it's not. (console log shows the event click, but nothing happens - in IE, Edge, and Firefox - only in chrome it works) var hiddenCanvas = document.createElement('canvas'); hiddenCanvas.width = canvas.width * 0.388; hiddenCanvas.height = canvas.height; var canvasContext = hiddenCanvas.getContext('2d'); canvasContext.drawImage( canvas, 0, 0, canvas.width * 0.388, canvas.height, 0, 0, canvas.width * 0.388, canvas.height); var aTag = document.createElement('a'); aTag.setAttribute('href', hiddenCanvas.toDataURL("image/png")); aTag.download = "ONV_oTeuDoutor.png"; this.saveimg2.addEventListener('click', salvarimagem2.bind(this)); function salvarimagem2() { console.log("salvar imagem"); aTag.click(); }
... View more