0

I'm using mPdf version 6 and want to add new custom font in it but it's not using new font family. What I did is:

  • mpdf\ttfonts folder
  • in config_fonts.php file added following code in fontdata:

    "helvetica" => array( 'R' => "helvetica-neue-condensed-black-59233f88d5395.ttf", ),

where "helvetica-neue-condensed-black-59233f88d5395.ttf" is the name of the file.

Following is my mPdf code for creating pdf:

    $mpdf = new \Mpdf(['mode' => 'c']);
    $mpdf->SetFont('helvetica');
    $mpdf->SetTitle('PDF title');
    $mpdf->AddPage('P','','','','',8,8,5,5,10,10);
    $mpdf->WriteHTML($this->html);
    $mpdf->Output('test.pdf', 'd');

I checked whatever I write in SetFont nothing in Pdf changed..

Umair Malik
  • 1,403
  • 3
  • 30
  • 59

1 Answers1

0

As from the mpdf docs

  1. Core non-embedded fontsPermalink

PDF files have certain standard fonts: Helvetica, Times and Courier in the win-1252 character set, and Zapfdingbats and Symbol character sets. These fonts should be available to any PDF reading program, and do not need to be embedded in the PDF document.

Advantages: Small file size, fast processing, small memory usage.

Disadvantages: Limited choice of fonts for appearance. Will not display characters which are not in the win-1252 Symbols, or Dingbats codepages (suitable for most Western European languages).

To use core fonts only, use 'c' for the mode configuration key:

$mpdf = new \Mpdf\Mpdf(['mode' => 'c']);

Change the mode from c to something else.

Charlie Lynch
  • 383
  • 3
  • 6