Question: Change Font on Sale generated PDF

Change Font on Sale generated PDF

Hi, What file I need to edit to change the font of the generated PDF on sales ? I have the code just need to know which file. BR.

SF

Saif Fuad

Asked
Hi,
What file I need to edit to change the font of the generated PDF on sales ?

I have the code just need to know which file.

BR.
  • MS

    Mian Saleem

    Answered
    Hello,

    All the view files are `themes/default/admin/views/xxxxx/pdf.php`, please replace `xxxxx` with the modules such as sales, quotes and purchases. The sales pdf view file would be `themes/default/admin/views/sales/pdf.php`

    Thank you
  • SF

    Saif Fuad

    Answered
    Great
    I inserted the code

    ```
    <style>
    @font-face {
    font-family: "Segoe UI";
    font-weight: 300;
    src: local("Segoe UI Semilight"), local("Segoe UI");
    }

    body {
    font-family: Segoe UI, Dejavu Sans, Helvetica Neue, Arial, sans-serif;
    }
    </style>
    ```
    before line 10 but nothing actually happened , do I need to change >styles/pdf/pdf.css ?

    BR.
  • MS

    Mian Saleem

    Answered
    May I know pdf library are you using. You can try both `dompdf` & `mpdf` to check. It's might be font loading issue but I will try to check after your test with both.

    Thank you
  • SF

    Saif Fuad

    Answered
    Nice point, I am using mPDF, when I switch to dompdf I see the font is what I want but since it is Arabic letters it is being written backward, so here only mPDF solved the problem. but with mPDF the font still the old font not the one I want.

    Thanks.
  • MS

    Mian Saleem

    Answered
    Adding custom fonts to pdf involves extra coding. I am referring you to the guide below

    **For mPDF**: Library file path is `app/libraries/Tec_mpdf.php` and docs link is [https://mpdf.github.io/fonts-languages/fonts-in-mpdf-7-x.html](https://mpdf.github.io/fonts-languages/fonts-in-mpdf-7-x.html)

    **For dompdf**: Library file path is `app/libraries/Tec_dompdf.php` and docs link is [https://github.com/dompdf/dompdf/wiki/UnicodeHowTo](https://github.com/dompdf/dompdf/wiki/UnicodeHowTo)
  • SF

    Saif Fuad

    Answered
    Hi,
    Shall I open a ticket for that ?

    BR.
  • MS

    Mian Saleem

    Answered
    Hello,

    I am sorry as that can't be done in 10 minutes. May I know your preferred library to provide estimate.

    Thanks
  • SF

    Saif Fuad

    Answered
    Hi,
    app/libraries/Tec_mpdf.php
    I want the font to be Segoe UI Semilight

    Thanks
  • MS

    Mian Saleem

    Answered
    Hello,

    For mPDF, the ticket would be fine. Please [open the ticket](/support/tickets/new) with details and don't forget to attach the font file.

    Thank you
  • Login to Reply