如何通过 .Net 代码截取网站的屏幕截图?
是否可以使用 .Net 代码截取任何给定 URL 的屏幕截图?
最简单的方法是什么?
Is it possible to take a screen shot of any given url using .Net code?
What is the easiest way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只是偶然发现了这个:http://pietschsoft。 com/post/2008/07/C-Generate-WebPage-Thumbmail-Screenshot-Image.aspx
也许你可以使用一些东西?
Just stumbled over this: http://pietschsoft.com/post/2008/07/C-Generate-WebPage-Thumbmail-Screenshot-Image.aspx
Maybe something you could use?
我建议使用第三方方法来执行此操作,而不是自己执行。 不过,如果您坚持这样做,那么最严厉的方法是使用 System.Diagnostics.Process 启动浏览器,然后使用 GetDesktopImage 获取屏幕截图。
我确信有一种更简单的方法,但看起来像这样:
I'd suggest using a third-party approach for this, not doing it yourself. If you insist, though, then the heavy-handed way is to use
System.Diagnostics.Process
to launch a browser, thenGetDesktopImage
to get a screenshot.I'm sure there's an easier way, but that looks like this:
有几个第三方组件可以执行此操作。 显然这并不是一件小事,因为 Flash 之类的东西并不那么容易捕捉。
我过去使用过 HTMLSnapshot 并且对它很满意(它不是免费的,但相当便宜)。
我衷心建议您不要浪费太多时间自己实现这一点,因为您最终肯定会重做这些第三方解决方案已经处理的许多最终案例。
There are several 3rd party components that does this. Apparently it's not trivial, since things like Flash and stuff don't capture so easily, for example.
I've used HTMLSnapshot in the past and was pleased with it (it's not free, but pretty cheap).
I heartily suggest you don't waste too much time implementing this yourself because you're bound to end up redoing a lot of end-cases that these 3rd party solutions already handle.
我进行了广泛的搜索以找到此问题的解决方案,而使用 WebBrowser 和其他建议的问题是您需要对该框进行大量访问。
迄今为止,这是我能找到的最好的第三方工具:
http://www.websitesscreenshot.com/
他们的 SEO 很糟糕,但我相信我在论坛甚至 Stack 上找到了他们......我确实拥有一个许可证,你得到的只是一个可以引用的 DLL。 将许可证传递给建造者会删除他们的水印。
快速浏览一下 ILSpy 后,我相信它的作用是解释 HTML 并转储图像以供您观看。
使用
保存 URL
保存原始 HTML 字符串
您可以在其使用页面上找到更多信息。 在这里找到:
http://www.websitesscreenshot.com/Usage.html
希望这有帮助!
干杯!!
I searched far and wide to find a solution to this problem and the issue with using the WebBrowser and other suggestions is that you need a lot of access to the box.
To date this is the best third party tool I have been able to find:
http://www.websitesscreenshot.com/
Their SEO is terrible, but I believe I found them on a forum or even Stack... I do own a license and what you get is just a single DLL you can reference. Passing a license to the constructor removes their watermark.
After a quick peek with ILSpy I believe what it does is that it interprets the HTML and dumps an image for your viewing pleasure.
Usage
Saving A URL
Saving Raw HTML String
You can find more on their usage page. Found Here:
http://www.websitesscreenshot.com/Usage.html
Hope this helps !
Cheers!!