1

I'm having a very weird EPIPE write error when I'm trying to generate a PDF from HTML with this module:

https://www.npmjs.com/package/html-pdf

The exact error:

events.js:72 throw er; // Unhandled 'error' event ^ Error: write EPIPE at errnoException (net.js:904:11) at Object.afterWrite (net.js:720:19)

The line where I call the PDF gen:

var pdfgen = require("html-pdf");
pdfgen.create(html, options).toFile('whappbook.pdf', function(err, res) {
  var errorCount = 0;
  if (err) {
    console.log(err);
    errorCount++;
    if(errorCount > 2) {
      return console.log(err);
    } else {
      return create();
    }
  }
  console.log(res); // { filename: '/app/businesscard.pdf' }
});

I've tried just using <h1>Testing</h1> as the HTML to see if the file was too big, but that wasn't the case.

Note: local everything works perfectly fine, but when I run this code on Appfog it doesn't work, so I suspect it has something to do with missing dependencies or file writing rights.

I'm writing directly to the home directory (in Appfog's case thats /app).

HTML-PDF is using PhantomJS and I've also directly npm'd that in my app because some people were reporting issues when it wasn't directly installed, but that didn't solve my problem either.

If there is any information that I can additionally provide please let me know!

Andre
  • 893
  • 2
  • 9
  • 30

0 Answers0