yum -y install bitmap-fonts bitmap-fonts-cjk mkfontscale fontconfig cjkuni-fonts*  中文字体

http://phantomjs.org/
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2

rander.js:
var page = require('webpage').create(),
    system = require('system'),
    address, output, size;

if (system.args.length < 3 || system.args.length > 5) {
    console.log('Usage: rasterize.js URL filename');
    phantom.exit(1);
} else {
    address = system.args[1];
    output = system.args[2];
    page.viewportSize = { width: 1280, height: 1580 };     设定默认大小
    page.open(address, function (status) {
      // 通过在页面上执行脚本获取页面的渲染高度
      var bb = page.evaluate(function () { 
        return document.getElementsByTagName('html')[0].getBoundingClientRect(); 
      });
      // 按照实际页面的高度,设定渲染的宽高
      page.clipRect = {
        top:    bb.top,
        left:   bb.left,
        width:  bb.width,
        height: bb.height
      };
      // 预留一定的渲染时间
      window.setTimeout(function () {
        page.render(output);
        page.close();
        console.log('render ok');
        phantom.exit();
      }, 1000);
    });
}

截图命令 : 
/usr/local/src/phantomjs-2.1.1-linux-x86_64/bin/phantomjs rander.js 
http://192.168.1.5:9380/DaChuibus/manage/statistics/allstatistics/quanjutongji.do 1.png

results matching ""

    No results matching ""