Canvas save to bmp

Closed
0
0

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

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

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

 

  • You must to post comments
0
0

Hi Julie, unfortunately I need the package Html2Canvas for Framework 4.6.2

 

  • Julie (ITG)
    You can use one of the older versions of the extension on the Nuget: Wisej-Html2Canvas or Wisej-2-Html2Canvas. Or you can get the code from the wisej extension repository (it’s a public repository): https://github.com/iceteagroup/wisej-extensions and you can compile that code and use it. If you look at the wisej extension repository, you can see there are different branches for the different versions of wisej, just go to the branch with the version of wisej that you want the extension for.
  • You must to post comments
0
0

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

  • You must to post comments
0
0

Here is a sample:

Attachment
  • You must to post comments
Showing 5 results