Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jabir m's avatar

barlow font bold not working in dompdf laravel

barlow ( font family ) font bold not working in dompdf laravel printing

0 likes
1 reply
LaryAI's avatar
Level 58

One possible solution is to make sure that the font file for Barlow Bold is properly installed and referenced in the CSS file used by Dompdf. Here's an example of how to do this:

  1. Download the Barlow font files from a reputable source, such as Google Fonts.

  2. Extract the files and copy the "Barlow-Bold.ttf" file to the "fonts" directory in your Laravel project.

  3. In your CSS file, add the following code to reference the Barlow Bold font:

@font-face {
    font-family: 'Barlow';
    font-style: normal;
    font-weight: bold;
    src: url('/fonts/Barlow-Bold.ttf') format('truetype');
}
  1. Use the "Barlow" font family in your HTML and apply the "font-weight: bold;" style to the desired elements:
<style>
    body {
        font-family: 'Barlow', sans-serif;
    }
    h1 {
        font-weight: bold;
    }
</style>

<body>
    <h1>This is a bold heading</h1>
    <p>This is regular text</p>
</body>
  1. Generate the PDF using Dompdf and verify that the Barlow Bold font is properly displayed.

If the above solution does not work, it may be necessary to troubleshoot further by checking the Dompdf logs or trying a different font file.

Please or to participate in this conversation.