使用phantomjs将Meteor导出为PDF

使用phantomjs将Meteor导出为PDF,pdf,meteor,phantomjs,Pdf,Meteor,Phantomjs,在我的项目中,我需要生成一个PDF流星,就像一份报告。我正在研究,我认为viavem的最佳选择是使用phantomjs,但我遇到了一些困难。 通过npm安装在phantomjs meteor中,并运行以下命令进行一些测试: var phantom = Meteor.require('phantomjs'); phantom.create(function(ph){ ph.createPage(function(page) { page.open("http:/

在我的项目中,我需要生成一个PDF流星,就像一份报告。我正在研究,我认为viavem的最佳选择是使用phantomjs,但我遇到了一些困难。 通过npm安装在phantomjs meteor中,并运行以下命令进行一些测试:

var phantom = Meteor.require('phantomjs');
    phantom.create(function(ph){
      ph.createPage(function(page) {
        page.open("http://www.google.com", function(status) {
          page.render('google.pdf', function(){

            console.log('Page Rendered');
            ph.exit();

        });
      });
    });
  });
但是Meteor返回给我以下错误:

Object #<Object> has no method 'create'
Object#没有方法“create”

有人能帮我吗?

phantomjs脚本只使用
phantomjs
运行,通常不直接使用
nodejs
(因此也使用meteor)。尝试在phantomjs周围使用npm包装器,比如如果报告相对简单,请查看。