Thursday, March 19, 2015

How To Convert HTML into Image with Download Link of Dlls

In this tutorial I will show you how you can convert your HTML markup into a Image

For this you will need to import the following dll's in your project.

HtmlRenderer
HtmlRenderer.W

Both files are password protected, the password is 'taqi' without quotes

After downloading the above 2 dlls add the their reference in your project

using TheArtOfDev.HtmlRenderer.WinForms;

Code

string html = "<h1>This tutorial shows how to convert HTML to Image</h1>";
int height = 700;
int width = 200;
string strfn = ("Test.png");
System.Drawing.Image objimg;
objimg = HtmlRender.RenderToImage(html, width, height);

FileStream fs = new FileStream(strfn,
FileMode.CreateNew, FileAccess.Write);
objimg.Save(fs, ImageFormat.Bmp);
objimg.Dispose();

fs.Flush();
fs.Close();

I hope it was informative for you, and I would like to Thank you for your time
Thanks

No comments:

Post a Comment