I am experiencing an issue where the font sizing for rendered PDFs is larger in production. Everything looks great on the PDF generated in development.
wkhtmltopdf
can (and will) use system fonts to render content through its headless wekbkit browser.
So your issue is really an issue of differing environments in development and production.
If you have some control over your server, you might try installing freetype
and fontconfig
packages to get extra fonts on your server, or serving your fonts in your stylesheets as OTF files like this:
# in application.css.erb
@font-face {
font-family: 'OpenSansRegular';
src: url('<%= font_url('OpenSans.otf') %>');
font-weight: normal;
font-style: normal;
}
and telling the stylesheet to use that:
body {
font-family: 'OpenSansRegular';
font-size: 13px;
}
If you don't have the font in OTF, here's a service to convert them.