0

I'm using DOMPDF v0.8.0

I'm having a problem with this library. I'm using this dompdf library with codeigniter2.

I need to implement digital signature and convert the html into pdf. This signature section have different fonts. I'm using google fonts for signature.

I'd added this font to html

<link href="https://fonts.googleapis.com/css?family=Herr+Von+Muellerhoff" rel="stylesheet">

And added the font-family to a particular <span> tag.

<span style='font-family: Herr Von Muellerhoff;'> test sign </span>

But now I'm getting the whole pdf page in which this <span> tag exist having this font family. Remaining pages have default fonts.

I also tried with <font> tag but no success

<font face='Herr Von Muellerhoff'> test sign </font>

Can anyone help me out from this?

Poonam
  • 549
  • 4
  • 15
  • Can you produce a simplified HTML document that exhibits the issue? – BrianS Aug 07 '17 at 22:54
  • I'd tried with simple HTML and PHP and it's working fine. I think the issue is with codeigniter + DOMPDF. – Poonam Aug 08 '17 at 07:48
  • Perhaps. If you can get the actual HTML being passed to dompdf you can try [validating it](http://validator.w3.org/). If that doesn't help paste a sample of it back here. – BrianS Aug 08 '17 at 22:00
  • I got this message after validating the HTML : `Document checking completed. No errors or warnings to show.` But the pdf problem still there. – Poonam Aug 09 '17 at 06:15
  • Is the HTML something you can share here? – BrianS Aug 09 '17 at 16:15
  • Thank you so much for your support. I'd resolved the issue. – Poonam Aug 10 '17 at 07:11
  • I'd added one more google font in the html and set that `font-family` to body. In my code may be the default font was not working or something like this. – Poonam Aug 10 '17 at 07:14

1 Answers1

0
  1. get the css with: wget https://fonts.googleapis.com/css2\?family\=Herr+Von+Muellerhoff:wght@300\;400\;700 and you get:

    @font-face { font-family: 'Herr Von Muellerhoff'; font-style: normal; font-weight: 400; src: url(https://fonts.gstatic.com/s/herrvonmuellerhoff/v13/WBL6rFjRZkREW8WqmCWYLgCkQKXb4CAft3c6.ttf) format('truetype'); }

2 Add css to your dompdf template

3 get zip font file from google fonts : https://fonts.google.com/specimen/Herr+Von+Muellerhoff (click on download family button) and copy the content zip file to your storage/fonts on your laravel directory

  1. Enjoy