生成网站页面的截图
思路 cmd 調用GUI截圖工具
代碼如下
public string ExeCommand(string commandText)??? {
??????? Process p = new Process();
??????? p.StartInfo.FileName = "cmd.exe";
??????? p.StartInfo.UseShellExecute = false;
??????? p.StartInfo.RedirectStandardInput = true;
??????? p.StartInfo.RedirectStandardOutput = true;
??????? p.StartInfo.RedirectStandardError = true;
??????? p.StartInfo.CreateNoWindow = true;
??????? string strOutput = null;
??????? try
??????? {
??????????? p.Start();
??????????? p.StandardInput.WriteLine(commandText);
??????????? p.StandardInput.WriteLine("exit");
??????????? strOutput = p.StandardOutput.ReadToEnd();
??????????? p.WaitForExit();
??????????? p.Close();
??????? }
??????? catch (Exception e)
??????? {
??????????? strOutput = e.Message;
??????? }
??????? return strOutput;
??? }
調用?
ExeCommand("G:" + Environment.NewLine +????????????????????? @"IECapt --url=http://www.qq.com/ --out=localfile.png");
?
GUI截圖工具下載(開源免費) 下載地址http://iecapt.sourceforge.net/
?
轉載于:https://www.cnblogs.com/weiyuxinghuacun/archive/2011/04/08/2009766.html
總結
- 上一篇: 从Bayes角度理解Deep learn
- 下一篇: 简单地发布EJB程序的过程