Reputation: 1919
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?!!
Upvotes: 12
Views: 22209
Reputation: 1
You can access to http://fonts.snm-portal.com/ in order to convert .ttf or .otf file to some files TCPDF can read. Then download 3 files: font_name.z,arial.ctg.z,arial.php and move to /tcpdf/fonts folder. Then you can use "font_name" in $pdf->SetFont function.
Upvotes: 0
Reputation: 274
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);
Upvotes: 25