从Nuget中安装HtmlRenderer.WinForms (这个包就有 HtmlRenderer dll)
private void ConvertHtmlContentToImage()
{
string html = "<h1>Welcome </h1><div><img src=‘https://www.google.com.sg/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png‘/></div>";
var image = HtmlRender.RenderToImage(html);
image.Save("E:\\UserGoogle1.jpg");
}
时间: 2024-11-07 08:46:32