wkhtmltopdf and font size shrinkage

10 September 2010   0 comments   Web development

Mind That Age!

This blog post is 8 years old! Most likely, its content is outdated. Especially if it's technical.

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.


Thank you for posting a comment

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 Keyword:
Printer friendly and PDF version of every page 14 January 2004
PythonPoint 10 January 2004
Related by Text:
How to use premailer as a command line script 13 July 2012
Web Performance Optimization of a Single-Page-App and web fonts 16 March 2017
Good summary about Ricardo Semler 14 September 2003
A quicksearch for Bugzilla using Autocompeter 27 January 2016
Ugliest site of the month, hernia.org 18 November 2004