Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
17630 มุมมอง

How can I use a custom font in the header of the pdf reports? AFAIK I have to create a custom css file, but where do I  have to put it (together with the font file)  on the server?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

you can put it in your template tag just before your header

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Steps : 

1- add your font ttf in path : yourmodulename/static/src/fonts/DroidKufi-Bold.ttf          # For Example i used DroidKufi Font

2- You Have to create new path in static  : /static/src/css/style.css Make sure to add this code :

.font{
font-family:'traditional_arabic';;font-weight:100;font-size: 13px; ### Here add your font family name
}

@font-face {
font-family: 'DroidArabicKufiBold';
src: url('/yourmodulename/static/src/fonts/DroidKufi-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}

@font-face {
font-family: 'DroidArabicKufiRegular';
src: url('/yourmodulename/static/src/fonts/DroidKufi-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

.arabic{
font-family:DroidArabicKufiRegular !important;
}

table.cr-table tbody tr:last-child
{
height:100%;
}

3- add link rel path to your template then your style :





อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi, Open this link i hope it's help you.

https://www.odoo.com/forum/help-1/question/how-to-add-custom-fonts-to-qweb-reports-88923

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can check this module this helps! 

https://apps.odoo.com/apps/modules/15.0/advanced_report_templates/

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You can write style tag in custom report.

Ex:

<style>

@font-face {

font-family: myFirstFont; src: url(sansation_light.woff);

}

div {

    font-family: myFirstFont;

}

</style>

Using style tag you can use custom font in qweb report.


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thanks - but:  where do I have to put the font file on my local odoo server and how does the url have to look like?

อวตาร
ละทิ้ง