dompdf font family issue

半城伤御伤魂 提交于 2019-12-11 02:35:41

问题


I'm using Bamboo invoice as an invoice generator, and I'm trying to customize the invoice template, but no matter what I do, the font just won't seem to adjust.

currently I have

body {
margin: 0.5in;
font-family: 'helvetica';
font-size: 10pt;}

I've read up on it, and helvetica is an installed font, so it should work

to make sure I changed it to 'courier'; which is also in the lib/fonts directory, but the font remains the same.

Any help?


回答1:


Kinda late, but still applicable for google visitors

I had a similar problem with DomPDF, but since BambooInvoice uses it... Anyway DomPDF has trouble with the font-family definition in the CSS. I applied inline style to the top div box to solve the problem.

<div id="container" style="font-family:sans-serif;">
....
</div>



回答2:


I solved my problem by removing a font: inherit that was applied as a 'css-reset' to almost all elements as a first declariation. Apparently this is not overridden by later declarations, and/or inherit doesn't work properly.




回答3:


I had similar problem with DomPDF 6b3 when trying to use font-family or font-size. Finally discovered that using font instead of those seems to be working.




回答4:


Remove the quotes around helvetica.



来源:https://stackoverflow.com/questions/2792315/dompdf-font-family-issue

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