1

I am building a meteor application that creates pdf files from a web page using phantomjs.

PhantomJS is called with node's child_process.exec function within a fiber using Meteor._wrapAsync. When I am using any url like google.com, it is working fine and the pdf is created.

The problem is, I want to capture a site served by the same meteor application at /invoicePDF. But during the execution of phantomjs the site apparently does not load, thus, it cannot load inside phantomjs, which makes finishing the call to phantomjs impossible.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
leoweigand
  • 154
  • 1
  • 9
  • Does it load when you call the phantomjs with your script directly? If not, please register to the [`onConsoleMessage`](https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#webpage-onConsoleMessage) and [`onError`](https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#onerror) events. Maybe there are errors. – Artjom B. Sep 09 '14 at 22:07
  • When phantomjs is called directly, it works. `onConsoleMessage` and `onError` do not show anything. – leoweigand Sep 09 '14 at 23:52

1 Answers1

0

The solution seemed to be to use Meteor.bindEnvironment instead of Meteor._wrapAsync. Unfortunately, I have know idea why.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
leoweigand
  • 154
  • 1
  • 9