Tagged: phantomjs


利用phantomjs将HTML源代码转换成图片

通常我们的需求是将网页渲染成图片保存,那么也会有这样的情况,将HTML源代码转换成图片,下面的代码将满足需求: 

var page = require("webpage").create();
page.viewportSize = { width: 200, height : 200 };
page.content =  "This Text will be converted to Image";
page.setContent(page.content,page);
window.setTimeout(function ()[......]<p class="read-more"><a href="http://neoremind.com/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/">继续阅读</a></p>

如何用phantomjs操作修改DOM并截图

前一篇初步学会了如何使用phantomjs实现基本的网页截图,跟进上一篇的TODO,如何操作网页的DOM后再进行截图呢?That is to say, how to use phantomjs to manipulate DOM and render image?

 

参考phant[……]

继续阅读

在Linux上利用phantomjs进行网页截图

1. phantomjs介绍

基于Javascript驱动的命令行webkit引擎,轻量级,安装简单,开发快速,渲染速度较快
无界面的webkit浏览器
更多介绍可以参考 http://code.google.com/p/phantomjs
 

2. phantomjs应用场景

[……]

继续阅读