Custom Fonts for DOMPDF Custom Fonts for DOMPDF php php

Custom Fonts for DOMPDF


  1. go to your DOMPDF folder
  2. copy your font's as .ttf (TrueType Font) or .otf (OpenType Font) into the DOMPDF's root
  3. open your command line and run
    php load_font.php your_fonts_name ./your-normal.ttf ./your-bold.ttf ./your-bold-italic.ttf
  4. DOMPDF now created Adobe Font Metrics and copied it to lib/fonts/* - you can now use it with
    font-family: your_fonts_name;


you can add css font :

@font-face {    font-family: new_font;    src: url('my_font.ttf');}

and than

div.ClJ{    font-family: new_font; }


If you want to install custom fonts to the server without a command-based interfacethen you can do the following web-based model to install the custom fonts

  1. Download ejaz.php from here
  2. Put this file to the root of dompdf and follow the instruction written in it

no need for root or command/terminal access