从html页面获取打印屏幕 [英] Taking print screen from html page
本文介绍了从html页面获取打印屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我有html内容显示它,我想将此页面保存为我本地PC上的图像。
可以帮到我吗?
谢谢
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
推荐答案
请遵循以下文章。
1. 用C#打印屏幕 [ ^ ]。
2. 使用C#捕获屏幕截图 [ ^ ]。
3. 使用C#捕获屏幕图像 [ ^ ] 。
4. [应用程序]屏幕截图应用程序 [ ^ ]
Follow the below articles.
1. Print Screen in C#[^].
2. Capturing screenshots using C#[^].
3. Capturing the Screen Image Using C#[^].
4. [Application] Screen Shot Application[^]
当我使用此代码时
when i used this code
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();
}
错误告诉我
Base-64字符串中的字符无效
an error tells me
Invalid character in a Base-64 string
首先,不要将更新的代码作为解决方案发布。您应该更新您的问题。关于你的问题,你可以查看这个 [ ^ ] article。
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.
这篇关于从html页面获取打印屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文