Skip to main content

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.

public class Html2Canvas : 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

Static memberScreenshot(callback)

Takes a screenshot of the browser.

ParameterTypeDescription
callbackActionCallback method that receives the Image object.

Throws:

Static memberScreenshot(options, callback)

Takes a screenshot of the browser.

ParameterTypeDescription
optionsHtml2CanvasOptionsThe Html2CanvasOptions to pass to the html2canvas call.
callbackActionCallback method that receives the Image object.

Throws:

Static memberScreenshot(target, callback)

Takes a screenshot of the specified Control.

ParameterTypeDescription
targetControlThe Control to render to an Image
callbackActionCallback method that receives the Image object.

Throws:

Static memberScreenshot(target, options, callback)

Takes a screenshot of the specified Control.

ParameterTypeDescription
targetControlThe Control to render to an Image
optionsHtml2CanvasOptionsThe Html2CanvasOptions to pass to the html2canvas call.
callbackActionCallback method that receives the Image object.

Throws:

Static memberScreenshotAsync(options)

Asynchronously returns an Image that represents a screenshot of the browser.

ParameterTypeDescription
optionsHtml2CanvasOptionsThe Html2CanvasOptions to pass to the html2canvas call.

Returns: Task. An awaitable Task that contains the screenshot.

Static memberScreenshotAsync(target, options)

Asynchronously returns an Image that represents a screenshot of the specified Control as it appears on the browser.

ParameterTypeDescription
targetControlThe Control to render to an Image
optionsHtml2CanvasOptionsThe Html2CanvasOptions to pass to the html2canvas call.

Returns: Task. An awaitable Task that contains the screenshot.

Inherited

Methods

NameDescriptionFrom
Update()Component