2014年10月6日 星期一

CentOS 7 phantomjs 中文使用筆記

安裝
download phantomjs-1.9.7-linux-x86_64.tar.bz2
yum install fontconfig freetype  libstdc++
yum install *fonts*

使用範例
編輯 exp.js 內容如下
var page = require('webpage').create();

page.open('http://www.google.com', function() {

    page.viewportSize = {width: 1024, height: 768};
    page.render('screenshot.png');
    phantom.exit();
});

 ./phantomjs exp.js

沒有留言: