0

I want to use Arial as the font for my PDF. But it only works in a local site, but not online. I am doing this project with Codeigniter. Below is my code.

 @font-face {
    font-family: "arial";
    src: url('<?php  echo admin_asset_url();?>/arial.ttf');
   }
 body,h1,h2,h3,li,a,p,h4{
        font-family: "arial";
    }
function pdf_create($html, $filename='', $stream=TRUE) 
{
    require_once("dompdf/dompdf_config.inc.php");

    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf");
    } else {
        return $dompdf->output();
    }
}
alexwlchan
  • 5,699
  • 7
  • 38
  • 49
Shreeraj Karki
  • 234
  • 2
  • 11

1 Answers1

1

This is probably because domPDF is loading the font from your server witch, when accessing your localhost, probably is your computer.

Your server on the other hand probably don't have arial installed. Hence it is not working.

Se this link for more info on domPDF and fonts

Philip G
  • 4,098
  • 2
  • 22
  • 41
  • 1
    Also, for general info on fonts in dompdf see this answer: http://stackoverflow.com/a/24517882/264628 – BrianS Mar 24 '15 at 02:14