How to implement custom fonts in TCPDF

后端 未结 13 908
鱼传尺愫
鱼传尺愫 2020-11-28 10:07

In TCPDF, there are only a few fonts to choose from, to create pdf files. I want to set Tahoma as my pdf font. How can I include Tahoma in TCPDF??<

13条回答
  •  孤城傲影
    2020-11-28 10:53

    the below lines will generate 3 files in ur fonts folder 1.rotisserifi56.php 2.rotisserifi56.ctg 3.rotisserifi56.rar

        use this to generate the required php and other files
    $fontname = $this->pdf->addTTFfont('D:/wamp/www/projectname/sites/all/modules/civicrm/packages/tcpdf/fonts/Rotis Serif Italic 56.ttf', 'TrueTypeUnicode', '', 32);
    
        // use the font
        $this->pdf->SetFont($fontname, '', 14, '', false);
    

    Now,

    use the fonts like this:

     $this->pdf->AddFont('rotisserifi56', '', 'rotisserifi56.php');
    $this->pdf->SetFont('rotisserifi56');
    

    --hope this helps some one :)

提交回复
热议问题