网页渲染捕获
我首先描述问题本身。我不是在寻找一个问题,而是在寻找更好的解决方案。我有一个 asp.net 页面,其中有一堆图像和其下方的链接,每个图像实际上都是其下方链接的最新呈现。
我安排了一个每小时运行一次的bat脚本,通过IECapt(一个网页渲染捕获实用程序)获取图像。我对这个实用程序感到恼火的一件事是,它需要花费大量时间来处理我拥有的 20 张图像,而只有少数图像因为它错过了 Flash 内容来获取网站的实际屏幕截图。
现在我想知道这种渲染是否可以通过传统编程来完成,我对使用任何实用程序不感兴趣。我有兴趣尝试这个。该解决方案不一定是基于 C# 的,也可以尝试使用任何其他语言。因为它给了我一个学习的机会。
谢谢。
I start with describing the problem itself. Rather than a problem I'm looking for a better solution. I have a asp.net page which has a bunch of images and a link underneath it, Each image is infact the latest rendering of the link underneath it.
I scheduled a bat script which runs every hour to fetch the images through IECapt a web page rendering capture utility. One thing am annoyed about this utility is it takes a lot of time for the 20 images I have and for few because of the flash content it misses to take the actual screenshot of the website.
Now I like to know can this rendering be done by traditional programming am not interested in using any utilities. I'm interested in trying this. The solution need not be necessarily a C# based am ready to try in any other language. Because it gives me a chance to learn.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可能应该查看 moz-headless-screenshot
您应该能够嵌入您需要的功能。
http://blog.mozilla.com/ted/2010 /07/29/moz-headless-screenshot/
他还提供了一个名为 moz-headless-screenshot 的示例嵌入客户端应用程序。
这是一个简单的命令行工具,它接受 URL、图像大小和输出文件名
并生成网页的 PNG 屏幕截图。
You should probably look at moz-headless-screenshot
You should be able to embed the functionality you need.
http://blog.mozilla.com/ted/2010/07/29/moz-headless-screenshot/
he also provided a sample embedding client application called moz-headless-screenshot.
This is a simple command line tool that takes a URL, image size, and output filename
and generates a PNG screenshot of the webpage.
您应该查看浏览器截图:
http://browsershots.org/
它们可以做您想做的很多事情不同的浏览器。它甚至是开源的。
You should look into browser shots:
http://browsershots.org/
They do what you want to do for lots of different browsers. It is even open source.
对于您要求做的事情,没有简单的解决方案。这是因为渲染 HTML、CSS 和 Flash 实际上是一个非常复杂的过程。
如果您需要进行大量编码,则可以使用 Gecko 引擎(为 Firefox 提供动力)或其他开源 Web 浏览器核心(即 Dillo)将页面渲染到自定义画布上。然后将该画布保存到文件中。不过,除非您实现对浏览器插件的支持,否则您将无法通过这种方式获得 Flash。你可以尝试使用 Gnash 或类似的工具。祝你好运。
我不知道有哪个开源项目已经做到了这一点。不过,这会很整洁:-)。如果你写了什么,请把它推向全世界;如果有一个“获取此 URL 的屏幕截图”工具,那就太酷了。
There's no simple-simple solution for what you're asking to do. This is because rendering HTML, CSS, and Flash is actually a very sophisticated process.
If you're up for quite a bit of coding, you can use the Gecko engine (which powers firefox) or another open-source web-browser core (ie Dillo) to render the page onto a custom canvas. Then save that canvas to a file. Unless you implement support for browser plug-ins, you won't get Flash this way, though. You could try using Gnash or its like. Good luck with that.
I don't know of an open-source project that already does this. It would be neat, though :-). If you write something, please push it to the world; it would be really cool to have a "get a screencap of this URL" tool.
一种方法是使用 IRobotSoft 网络抓取工具。您可以设计一个机器人每小时访问该 URL,并通过函数 CapturePage(imagefile) 将整个网页捕获为图像。
我不确定它是否会比 IECapt 更好。
One way is to use IRobotSoft web scraper. You can design a robot to go to the URL every hour, and capture the whole web page as an image via a function CapturePage(imagefile).
I am not sure if it will be better than IECapt though.
我们使用了 ACA WebThumb ActiveX 控件 (http://www.acasystems.com/en /web-thumb-activex/) 非常成功地捕获 Web 服务器中的部分或整个网页,然后将它们写入文件,只需传递 url。它的执行速度足以满足我们的需要。
我不熟悉 IECapt,但这可能是您可能想看看的东西。
We have used ACA WebThumb ActiveX Control (http://www.acasystems.com/en/web-thumb-activex/) quite successfully to capture parts or whole of a web page in the web server and then to write them to a file, just passing in the url. It performs fast enough for our need.
I am not familiar with IECapt, but this might be something you might want to have a look at.