• Resolved dobb

    (@dobb)


    Hello,
    Could you please provide a step-by-step instruction on how to include custom fonts in the PDF?

    This is what I did:
    1. added files SanomatSansRegular.woff and PortraitTextLFWeb-Bold.woff2.ttf in the dk-pdf/templates folder
    2. edited the dkpdf-index.php file. Added

    @font-face {
      font-family: 'Sanomat Sans Regular';
      src: url(SanomatSansRegular.woff);
    }	  
    @font-face {
      font-family: 'Portrait Text LF Web Bold Regular';
      src: url(PortraitTextLFWeb-Bold.woff2.ttf);
    }

    inside the <style> tag and

    <p style="font-family: 'Sanomat Sans Regular';">test test</p>
    <h1 style="font-family: 'Portrait Text LF Web Bold Regular';">Test test</h1>

    inside the <body> tag

    3. Created a test.html file inside the dk-pdf/templates folder and did the same as in step 2. The fonts are working fine in the test.html file but they’re not working in the PDFs

    I also tried to follow the instructions in this thread https://www.ads-software.com/support/topic/change-font-in-pdf/ but it seems that the mpdf file structure has changed – I couldn’t find the config_fonts.php file

    Thank you

    • This topic was modified 3 years, 8 months ago by dobb.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Add custom fonts to PDF’ is closed to new replies.