Click here to Skip to main content
15,904,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

i have html content displaying it and i want to save this page as an image on my local PC .
can any one helps me in this please ?

thanks
Posted

when i used this code
C#
try
       {
           string content = "";

           System.Net.WebRequest webRequest = WebRequest.Create(url);
           System.Net.WebResponse webResponse = webRequest.GetResponse();
           System.IO.StreamReader sr = new StreamReader(webResponse.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8"));
           content = sr.ReadToEnd();
           //save to file
           byte[] b = Convert.FromBase64String("<div>jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj</div>");
           System.IO.MemoryStream ms = new System.IO.MemoryStream(b);
           System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
           img.Save(@"E:\pic.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

           img.Dispose();
           ms.Close();
       }
       catch (Exception ex)
       {
           ex.ToString();
       }


an error tells me

Invalid character in a Base-64 string
 
Share this answer
 
First of all do not post your updated code as a solution. You should rather update your question. Regarding your question you may want to look at this[^] article.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900