Converting html files to pdf from the commandline05 Sep 2013
When you need to convert an
html file to a
I had to convert my
css resume to a
I finally resorted to using
wkhtmltopdf. It does the job, but
needs a few tweaks. First, you have to add
-T 0 -R 0 -B 0 -L 0 to remove the
margins. Then, you have to use the
file:// notation to target a local file.
Also, it does not understand the css properties
break-before. I had to manually add padding in my elements to stop them from
being cut in between two pages. But worst of all, it chokes on UTF-8
characters in filenames.
In the end, I wrote a small ruby wrapper around wkhtmltopdf to work around all those issues for me and called it html2pdf.
Want to add something ? Feel free to get in touch on Twitter : @pixelastic