wicked_pdf font size too large in production

守給你的承諾、 提交于 2019-12-01 11:17:15

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!