Error : Call to undefined method TCPDF::addTTFfont()
Use case : trying to use a custom font or local font.
Source code :
$fontname = $pdf->addTTFfont(‘D:\workspace-Project-PHP-barcode-QR-code\ThaiSansNeue-Regular.ttf’, ‘TrueTypeUnicode’, », 32);
Try this solution (version TCPDF 6.2.25) :
absolute path :
$fontname = TCPDF_FONTS::addTTFfont(‘D:\workspace-Project-PHP-barcode-QR-code\ThaiSansNeue-Regular.ttf’, ‘TrueTypeUnicode’, », 32);
relative path with the font file in the same directory of th php source file :
$fontname = TCPDF_FONTS::addTTFfont(‘ThaiSansNeue-Regular.ttf’, ‘TrueTypeUnicode’, », 32);
This article may contains affiliate links.