openlabs / docker-wkhtmltopdf-aas

wkhtmltopdf in a docker container as a web service.
BSD 3-Clause "New" or "Revised" License
99 stars 94 forks source link

Temp file not flushed before read by wkhtmltopdf #5

Closed ncjones closed 9 years ago

ncjones commented 10 years ago

The temp file used to store the posted source HTML is not flushed before being read by the wkhtmltopdf process. This results in an incomplete view of the uploaded HTML file being rendered. In the case of small files it always results in an empty PDF being generated.

For example, the following command will unexpectedly produce an empty PDF document (assuming app listening on port 8090):

$ echo '<html><body><h1>Hello World!</h1></body></html>' \
  | curl -X POST -F file=@- http://localhost:8090/ > output.pdf 
ncjones commented 10 years ago

Pull request #6 fixes this.

sharoonthomas commented 9 years ago

@ncjones just saw your PR. Merged it.

Thanks for the patch. :+1:

ncjones commented 9 years ago

@sharoonthomas FYI, you may want to look at pulling in the other changes from my fork including

See https://github.com/ncjones/html-pdf-webservice

sharoonthomas commented 9 years ago

@ncjones those changes look very interesting. any particular reason why you preferred to remove the JSON api ? do you have better ideas on sending options ?

ncjones commented 9 years ago

It was not needed for my usecase so I dropped it. I would use HTTP headers for providing rendering parameters.