php - wkhtmltopdf font not picked up on windows server -
i've been using php wkhtmltopdf , 1 of fonts have in html century gothic. on development machine (wamp on windows 7) fine , displays flawlessly, when putting on windows server 2007 machine, century gothic not displayed when generating pdf.
i checked see if century gothic installed, wasn't installed unfortunately has made no difference.
any appreciated.
to create pdf files custom fonts, specify them in css part of template.
example of project root folder (so works on windows , linux) :
$root = 'file://' . (system::iswindows() ? '/' : '') . str_replace('\\', '/', root_path); # windows output : file:///p:/www/project/ # linux output : file:///var/usr/www/project/ variable $root assigned template, use css specify font wanna use (put fonts use project, don't rely on system fonts):
<style type="text/css"> @font-face { font-family: 'font_local'; src: url('<?= $root ?>font/open_sans_regular.ttf') format('truetype'); font-weight: normal; font-style: normal; } body, body * { margin: 0; padding: 0; font-family: 'font_local'; font-size: 14px; line-height: 24px; } </style> for me best solution, because pdf file generated font, without standard fonts don't use, means smaller pdf files.
Comments
Post a Comment