diff --git a/images/save.png b/images/save.png new file mode 100644 index 0000000..cf2c68a Binary files /dev/null and b/images/save.png differ diff --git a/index.html b/index.html index 88e80ac..7660ceb 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,9 @@ +
diff --git a/js/activity.js b/js/activity.js index 2595c9b..e9fc15f 100644 --- a/js/activity.js +++ b/js/activity.js @@ -251,5 +251,21 @@ define(function (require) { update = true; shape = shape + 1; } + + function downloadCanvas(link, canvasId, filename) { + link.href = document.getElementById(canvasId).toDataURL(); + link.download = filename; + print_voucher(); + } + function print_voucher(){ + var win=window.open(); + win.document.write("
"); + win.print(); + win.location.reload(); + } + document.getElementById('save-button').addEventListener('click', function() { + downloadCanvas(this, 'myCanvas', 'My_Drawing.png'); + }, false); + }); });