Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dompdf does not render custom fonts #1776

Open
zringele opened this issue Jul 27, 2018 · 2 comments
Open

Dompdf does not render custom fonts #1776

zringele opened this issue Jul 27, 2018 · 2 comments
Labels

Comments

@zringele
Copy link

The $html string i send to dompdf gives me a good font when echo`ed. I have already tried to :

  • add fonts manually to dompdf/dompdf/lib/fonts
  • compile and save .afm and .ufm files to dompdf/dompdf/lib/fonts
  • uninstall and reinstall dompdf using file download and composer
  • downloading dompdf\utils and running load_fonts script in cmd

Here is my code where i call dompdf

$options = new Options();
$options->set('isHtml5ParserEnabled', true);
$dompdf = new Dompdf('A4', $options);
$dompdf->loadHtml($html, 'UTF-8');
$dompdf->setPaper('A4');
$dompdf->render();
$output = $dompdf->output();

Here is how it looks inside $html where i call my @font-face

<?php $link = yii\helpers\Url::base(true) . '/web/css/fonts/Roboto-Bold.ttf';
?>

@font-face {
   font-family: 'Roboto';
   font-style: normal;
   font-weight: normal;
   src: url( <?php echo $link ?>) format('truetype');
}
@lotarbo
Copy link

lotarbo commented Jul 30, 2018

I have the same problem. I can see new fonts in the folder and in dompdf_font_family_cache.php but pdf cant render Cyrillic text

@bsweeney
Copy link
Member

Would help to see a full sample showing the @font-face and the application of the font to an element via font-family.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants