I have an html canvas where things are drawn by the users( used FabricJs ).
In short the issues are(only in Chrome):
a) Right click > Save not working for the snapshot image from the canvas.
b) Sometimes the snapshot image is blank when trying to print.
I have created a testing version at: Codepen
Please check in Chrome.
There are 2 button beside the canvas - Download & Print.
Both having different issues - only in Chrome.
When the Download button is clicked an window is opened containing a snapshot image of the canvas using - canvas.toDataURL(). User then can right click on the image and save it. This works Ok in Firefox(user can right-click -> save the image). In chrome the dialog window opens with the image perfectly, but if right click on the image, then after selecting 'Save the Image' - nothing happens. The image is Ok, you can drag-drop-save it from the dialog window to desktop directly. But saving from the right-click-menu option does not work.
On 'Download' button click I am calling a function like the following to popup a window with the snapshot in it.
function open_dialog() {
var canvas_image_data = canvas.toDataURL();
var dlWindow = window.open("", "Download Image", "directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=500, height=500");
dlWindow.document.write('<img src="'+canvas_image_data+'" style="border: 1px solid #FF0000;" width="300" height="300"/>');
return dlWindow;
}
When the Print Button is clicked the Dialog with image snapshot is opened and browser's print features is called.
This also works Ok in FireFox, but in chrome - the image is blank in the print preview sometimes. In my testing(in several devices, the ratio is like - missing once in every 3/4 times in the Print button click).
Thanks in advance for any suggestions/clue for the issues!