Hi, I use the Canvas control so the user can write down his signature. This works fine now. Next step is to save the signature (from the Canvas control) into a file. Any suggestions?
Regards, Wim
There is no screenshot happening on IIS. The Html2Canvas extension uses an open source component (Html2Canvas) that redraws an HTML page into a canvas and returns the base64 content to the server which is then converted to an image. There are no security concerns involved.
To convert a canvas to a base64 image you have to use the canvas api. You can find here https://html2canvas.hertzen.com/ or you can see the source code we provide with the Html2Canvas extension that Julie mentioned. https://github.com/iceteagroup/wisej-extensions.
Hi Julie, sorry I’ve spend days now in trying to get my Canvas image saved. Without any result. Screenshot method doesn’t work on an IIS server for the obvious reason, it would be a huge risk creating screenshots on the server. Another possibility, which doesn’t work, is the “Canvas.ToDataUrl”….. Make a drawing on the canvas (also on touchscreens) works fine but makes no sense if we can’t store the result….
Regards,
Wim
Hi Julie, unfortunately I need the package Html2Canvas for Framework 4.6.2
Install the Html2Canvas Wisej extension in your Wisej project: (Right-click on the project under Solution Explorer, choose Manage Nuget Packages, Browse, search for “wisej html2canvas”, select it and install it)
https://docs.wisej.com/extensions/extensions/html2canvas
You can then use the Html2Canvas extension to save a screenshot of the contents of the canvas control:
private void button1_Click(object sender, EventArgs e)
{
AlertBox.Show("Saved canvasimage.bmp to the current directory");
// Use Html2Canvas to save a screenshot of the canvas contents
Html2Canvas.Screenshot(this.canvas1, (image) => { image.Save(@".\canvasimage.bmp"); });
}
More documentation on HTML2Canvas: https://docs.wisej.com/extensions/extensions/html2canvas/api/wisej.web.ext.html2canvas.html2canvas
Here is a sample: