TJkrusinski/NodePDF

Processing file gets created in a Temp directory

Closed this issue · 2 comments

Upon running the following code ...
NodePDF.render('http://www.google.com', 'google.pdf', function(err, filePath){
console.log(filePath);
});

"www.google.com" file gets created into HEQOS3~P directory in root (I think http:// is getting encoded into directory name). I have reinstalled phantomjs, nodejs and the plugin few times over last two days on Ubuntu but no dice.

render.js debugs looks good.

For some reason instead of creating the pdf, processing file is getting created. Increasing captureDelay has no effect.

phantomjs /usr/share/doc/phantomjs/examples/rasterize.js 'http://www.google.com' google.pdf
works perfectly.

Got it working by replacing following arguments in render.js.
Replaced if (!options.content) page.open(args[0]); with if (!options.content) page.open(args[1]);
and
Replaced page.render(args[1], { format: 'pdf', quality: options.outputQuality || '80' }); with page.render(args[2], { format: 'pdf', quality: options.outputQuality || '80' });

Can you submit a PR with your changes?