Phantomjs 幻影不';不显示呈现的页面

Phantomjs 幻影不';不显示呈现的页面,phantomjs,Phantomjs,我是phantomjs的新手,正在尝试弄清楚它是如何工作的。我举这个例子 var page = require('webpage').create(); console.log('test'); page.open('https://github.com/', function() { page.render('github.png'); phantom.exit(); }); 放入文件并执行 ./phantomjs phantomjs-2.0.0-macosx/examples/gi

我是phantomjs的新手,正在尝试弄清楚它是如何工作的。我举这个例子

var page = require('webpage').create();
console.log('test');
page.open('https://github.com/', function() {
  page.render('github.png');
  phantom.exit();
});
放入文件并执行

./phantomjs phantomjs-2.0.0-macosx/examples/github.js 
输出为

test

没别的了。我需要的是一些呈现页面的pdf文件

尝试设置视口大小并向渲染函数添加更多细节

var webPage = require('webpage');
var page = webPage.create();

page.viewportSize = { width: 1920, height: 1080 };
page.open("https://github.com", function start(status) {
  page.render('github.pdf', {format: 'pdf', quality: '100'});
  phantom.exit();
});

相同,只是viod输出是否检查项目所在的文件夹?请注册到
OnConsolleMessage
onError
onResourceError
onResourceTimeout
事件()。也许有错误。