traviscooper / node-wkhtml

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

[feature demand]"add" function works on html type #2

Open gitawego opened 13 years ago

gitawego commented 13 years ago

currently , PDF.add works only on url and file type, but it doesn't work on html type:

pdf = new PDF({
   html:"html content 1"
});
pdf.add({
   html:"html content 2"
});

it will generate:

echo 'html content 2' | wkhtmltopdf - -

then throw an error: Command failed: Loading pages (1/6).

I'm not very familiar on stdin :(

mhemesath commented 13 years ago

Yeah, this is really tricky. I'm not all that familiar with stdin either. I tried to get this feature to work, but unfortunately I can only seem to pipe in one input stream.

I'll leave this issue open. For now, concatenating the HTML beforehand is probably the best choice. If you need page breaks, CSS does support page break hints that webkit will honor.