HTML转图片
NodeJS + PhantomJS 抓取页面信息以及截图 http://www.cnblogs.com/justany/p/3279717.html
PhantomJS1.7 API http://www.cnblogs.com/ziyunfei/archive/2012/09/28/2705369.html
配置: Linux把PhantomJS加入到环境变量,window的直接运行exe文件。
利用phantomjs+casperjs实现登陆抓取网页并截图http://my.oschina.net/jiuxiaoyao/blog/148456
利用phantomjs将HTML源代码转换成图片http://neoremind.net/2013/02/%E5%88%A9%E7%94%A8phantomjs%E5%B0%86html%E6%BA%90%E4%BB%A3%E7%A0%81%E8%BD%AC%E6%8D%A2%E6%88%90%E5%9B%BE%E7%89%87/
PhantomJS是一个无界面的WebKit浏览器引擎,还有配套的JavaScript API.它原生支持各种web标准技术: DOM处理, CSS选择器, JSON, Canvas, 以及SVG.
通常我们的需求是将网页渲染成图片保存,那么也会有这样的情况,将HTML源代码转换成图片,下面的代码将满足需求:
保存成texttoimage.js
运行: phantomjs texttoimage.js
图片保存到newimage.png中
无需浏览器执行Javascript脚本:SlimerJS http://www.open-open.com/lib/view/open1374371986777.html
SlimerJS能够利用Javascript脚本来操作一个网页。SlimerJS允许你在浏览器外执行javascript脚本。
SlimerJS用于做功能测试,页面自动化,网络监控,屏幕捕捉,等。
SlimerJS类似于PhantomJs,但它运行在Gecko之上。而SlimerJS采用Mozilla Firefox浏览器引擎来代替Webkit。
CutyCapt: 开源网页截屏工具 CutyCapt Linux 下安装和使用
http://ddbean.wordpress.com/2011/02/19/%E5%BC%80%E6%BA%90%E7%BD%91%E9%A1%B5%E6%88%AA%E5%B1%8F%E5%B7%A5%E5%85%B7-cutycapt-linux-%E4%B8%8B%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/
截取指定网页图片-CutyCapt的应用http://jingyan.baidu.com/article/90895e0f8f704364ec6b0b97.html
Html2Image https://code.google.com/p/java-html2image/
在这里看到更新的包:http://evgenyg.artifactoryonline.com/evgenyg/repo/gui/ava/html2image/
HtmlImageGenerator Methods
loadUrl(url) – Loads HTML from URL object or URL string.
loadHtml(html) – Loads HTML source.
saveAsImage(file) – Save loaded HTML as image.
saveAsHtmlWithMap(file, imageUrl) – Creates an HTML file containing client-side image-map <map> generated from HTML’s links.
getLinks() – List all links in the HTML document and their corresponding href, target, title, position and dimension.
getBufferedImage() – Get AWT buffered image of the HTML.
getLinksMapMarkup(mapName) – Get HTML snippet of the client-side image-map <map> generated from the links.
get/setOrientation(orientation) – Get/Set document orientation (left-to-right or right-to-left).
get/setSize(dimension) – Get/Set size of the generated image
这个还能截图,但是要打开一个新窗口。要是服务器没有安装浏览器,那它就无能为力了。
Cobra: 介绍: http://blog.csdn.net/peerlessbloom/article/details/7046777
Cobra主页:http://lobobrowser.org/
Cobra API:http://lobobrowser.org/cobra-api/index.html
只支持jdk6 不支持jdk7, 因为jdk7删除了一些字体包
jsp网页快照,根据url获取页面缩略图 http://hi.baidu.com/bdgaojj/item/1ef674c17e0c807bcfd4f8de
java网页快照-网页转存为图片实现代码 http://www.111cn.net/jsp/java/43586.htm
个人觉得免费的java实现方式,最方便的网页快照生成方式。可以生成大型网页的快照。非常棒! 使用代码前需要导入 jar包。需要三个jar包 :swt-3.6M3-win32-win32-x86.jar,DJNativeSwing-SWT.jar,DJNativeSwing.jar
JSP网页快照代码(自动生成静态页面) http://blog.sina.com.cn/s/blog_40612750010005f5.html
Java 实现HTML 页面转成image 图片 http://blog.csdn.net/oscar999/article/details/8696769