Hi,
I installed a font on the server, and in qweb report I define the font:
<div style="font-family: '3 of 9 Barcode'; font-size: 3em; color: black;" t-esc="'*%s*' % o.carrier_tracking_ref"/>
The font work in html, but not in pdf.
Any Idea ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
I installed a font on the server, and in qweb report I define the font:
<div style="font-family: '3 of 9 Barcode'; font-size: 3em; color: black;" t-esc="'*%s*' % o.carrier_tracking_ref"/>
The font work in html, but not in pdf.
Any Idea ?
Hi,
I've recently found out that there are indeed issues with custom fonts in Odoo 11 & 12. You can find the bug report at https://github.com/odoo/odoo/issues/27503
Right now directly calling custom fonts in QWeb reports (printed as a PDF) does not work. You can use a workaround though. If you first define the font in <style type="text/css"> you will be able to use your custom font within your report. An example:
<?xml version="1.0" encoding="utf-8"?> <odoo> <template id="your_custom_report_document"> <t t-call="web.basic_layout"> <style type="text/css"> @font-face { font-family: 'MonixRegular'; src: local('MonixRegular'), local('MonixRegular'), url(/your_module/static/src/fonts/monix/Monix-Regular.otf) format('truetype'); } .h1-title { font-family: MonixRegular; } </style> <h1 class="h1-title">Your custom font</h1> </t> </template> <template id="your_custom_report"> <t t-call="web.html_container"> <t t-foreach="docs" t-as="doc"> <t t-call="your_module.your_custom_report_document"/> </t> </t> </template> </odoo>
Keep an eye out for the bug report, eventually a real fix should come.
Regards,
Yenthe
Hello, Mr. Yenthe,
I am getting error in odoo log:
2018-12-12 14:31:13,076 21164 INFO testserver werkzeug: 127.0.0.1 - - [12/Dec/2018 14:31:13] "GET /dev_print_cheque/static/src/fonts/micrenc.ttf HTTP/1.1" 404 -
Font file is copied:
root@testserver:/odoo/odoo-server/addons/dev_print_cheque/static/scr/font# ls
micrenc.ttf
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up