Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php Fatal error: Call to undefined method TCPDF::addTTFfont() in

Tags:

php

pdf

tcpdf

I`m using TCPDF class for making pdf file.

my code :

    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$fontname = $pdf->addTTFfont('../common/pdf/fonts/persianFont/HiwebNazanin.ttf', 'TrueTypeUnicode', '', 32);
$pdf->SetFont($fontname, '', 12, '', 'false');

I want to change the default font to my font and addTTFfont method has been sugested in TCPDF docs. but I get this error!!

Fatal error: Call to undefined method TCPDF::addTTFfont() in ...

why I cant use it?!!

like image 606
afsane Avatar asked Feb 15 '15 07:02

afsane


1 Answers

In TCPDF (Version 6.2.6) working with:

require_once('/your_path_to/tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$fontname = TCPDF_FONTS::addTTFfont('../common/pdf/fonts/persianFont/HiwebNazanin.ttf', 'TrueTypeUnicode', '', 32);
like image 111
pdf_mage Avatar answered Nov 15 '22 06:11

pdf_mage