wkhtmltopdf and font size shrinkage

10 September 2010   0 comments   Web development

Powered by Fusion×

wkhtmltopdf is by far the best tool available to make PDFs. Yes. I have tried ReportLab and PISA. ReportLab might be more powerful but what you gain in fine-grained control you lose in hours and hours of productivity.

Anyway, I've learned something about font-size shrinkage and using wkhtmltopdf. Basically, if use percentage to change a font size (Arial in this case) you get a PDF where the letters are unevenly spaced between. It took me a while to figure out what the hell was going on until I changed the font-size from 90% to exactly 11px.

font-size: 90% ('font-size:90%'; the spots of red are my highlights of the ugly spacings)

font-size: 11px ('font-size:11px'; not perfect but much better)

So, at first I thought this was the first time wkhtmltopdf has disappointed me but I guess I'll just have to remember not to use percentages and continue to favor wkhtmltopdf as my choice of weapon in the PDF production world.


Your email will never ever be published

Related posts

I just discovered wikiHow 08 September 2010
In jQuery, using the :visible selector can be dangerous 14 September 2010
Related by keywords:
Printer friendly and PDF version of every page 14 January 2004
PythonPoint 10 January 2004