0

I'm using WAMP and CodeIgniter. I'm using DomPDF and it works really great. Now I want to change font to Verdana in the PDFs that are created. As I understand from doing som reading Verdana isn't included in the core files of domPDF, but it is possible to add fonts.

I just found this. https://code.google.com/p/dompdf/source/browse/trunk/dompdf/lib/fonts/Verdana.ufm?r=96

But I want to download som font-files where Verdana is used for domPDF. How do I achieve that? (I'm looking for some download verdanafonts.zip or something like that)

I've tried to copy the contents of verdana.ufm and verdana.afm and saved them into the libs/fonts folder and change def("DOMPDF_DEFAULT_FONT", "serif"); TO def("DOMPDF_DEFAULT_FONT", "verdana"); but then I get an error that says verdana is an undefined index.

I'm using 0.6 version of domPDF.

bestprogrammerintheworld
  • 5,417
  • 7
  • 43
  • 72

1 Answers1

2

In order to add a font to dompdf you have to parse it to produce the font metrics file (*.AFM and/or *.UFM). Then you have to tell dompdf about the font by editing lib/fonts/dompdf_font_family_cache.

dompdf has always had a mechanism to help you out with the process. The load_font.php file will take a font and so long as the necessary libraries are available will produce the metrics and update your font family cache. With dompdf v0.6.x the php-font-lib font parsing library is used to produce the font metrics.

You can also use the CSS @font-face declaration to load fonts on-the-fly.

BrianS
  • 13,284
  • 15
  • 62
  • 125