FileConversionHelper.HtmlToImage Method

Namespace:
Weavy.Core.Helpers
Assembly:
Weavy.Core.dll

HtmlToImage(string, int, int, int, Color)

Renders the specified HTML into a new image of the requested size. The HTML will be layout by the given size but will be clipped if it cannot fit.

public static Image HtmlToImage(string html, int width, int height, int margin = 0, Color backgroundColor = null)

Parameters

html
string

HTML source to render.

width
int

The width of the image to render into.

height
int

The height of the image to render into.

margin
int

The margin used when rendering the HTML into the image.

backgroundColor
System.Drawing.Color

The color to fill the image with (the image cannot have transparent background, by default it will be white).

Returns

System.Drawing.Image

The generated image of the html.