Html2Canvas
Namespace: Wisej.Web.Ext.Html2Canvas
Assembly: Wisej.Web.Ext.Html2Canvas
Implementation of the html2canvas (https://html2canvas.hertzen.com/) library. It's a singleton instance that can take a screenshot of a specific control or the entire browser and send the image back to the server.
- C\\#
- VB.NET
public class Html2Canvas : Component
Public Class Html2Canvas
Inherits Component
Usage is quite easy:
Html2Canvas.Screenshot(this, (image) => {
image.Save(@"\images\screen.png");
});
// or using asynchronous code:
var image = await Html2Canvas.Screenshot(this.panel1);
image.Save(@"\images\screen.png");
Methods
Screenshot(callback)
Takes a screenshot of the browser.
| Parameter | Type | Description |
|---|---|---|
| callback | Action | Callback method that receives the Image object. |
Throws:
-
If any of the arguments is null.
Screenshot(options, callback)
Takes a screenshot of the browser.
| Parameter | Type | Description |
|---|---|---|
| options | Html2CanvasOptions | The Html2CanvasOptions to pass to the html2canvas call. |
| callback | Action | Callback method that receives the Image object. |
Throws:
-
If any of the arguments is null.
Screenshot(target, callback)
Takes a screenshot of the specified Control.
| Parameter | Type | Description |
|---|---|---|
| target | Control | The Control to render to an Image |
| callback | Action | Callback method that receives the Image object. |
Throws:
-
If any of the arguments is null.
Screenshot(target, options, callback)
Takes a screenshot of the specified Control.
| Parameter | Type | Description |
|---|---|---|
| target | Control | The Control to render to an Image |
| options | Html2CanvasOptions | The Html2CanvasOptions to pass to the html2canvas call. |
| callback | Action | Callback method that receives the Image object. |
Throws:
-
If any of the arguments is null.
ScreenshotAsync(options)
Asynchronously returns an Image that represents a screenshot of the browser.
| Parameter | Type | Description |
|---|---|---|
| options | Html2CanvasOptions | The Html2CanvasOptions to pass to the html2canvas call. |
Returns: Task. An awaitable Task that contains the screenshot.
ScreenshotAsync(target, options)
Asynchronously returns an Image that represents a screenshot of the specified Control as it appears on the browser.
| Parameter | Type | Description |
|---|---|---|
| target | Control | The Control to render to an Image |
| options | Html2CanvasOptions | The Html2CanvasOptions to pass to the html2canvas call. |
Returns: Task. An awaitable Task that contains the screenshot.
Inherited
Methods
| Name | Description | From |
|---|---|---|
| Update() | Component |