traviscooper / node-wkhtml

Convert html to PDF or PNG format using the webkit rendering engine, and qt.
104 stars 17 forks source link

Error: write EPIPE #14

Closed ticup closed 10 years ago

ticup commented 10 years ago

Hi, I'm trying to get the following sample code running

var http = require('http'),
  wkhtml = require('node-wkhtml');

http.createServer(function (request, response) {
  var pdf = wkhtml.spawn('pdf');
  pdf.stdout.pipe(response);
  pdf.stdin.end('<h1>Hello World</h1><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>', 'utf-8');
}).listen(8000);

But I keep getting the following error:

Uncaught exception : Error: write EPIPE
    at errnoException (net.js:769:11)
    at Object.afterWrite (net.js:593:19)

I'm running it on Node v0.8.11.

Anyone else having troubles with piping to the response?

Tim.

ticup commented 10 years ago

Well, this is embarrassing, I didn't have the executable properly set up. So if anyone encounters this problem setup you wkthml executables so they are available to the path! :)