Skip to content Skip to sidebar Skip to footer

How To Embed Fonts Into A PDF With TCPDF?

I have tried to use TCPDF whose code is given below: require_once($_SERVER['DOCUMENT_ROOT'].'/tcpdf/tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT,

Solution 1:

See TCPDF's documentation:

Using the addTTFfont() method you can directly create a TCPDF font starting from a TrueType, OpenType or Type1 font. NOTE: The 'fonts' folder must be writeable by the webserver.

For example:

$fontname = $pdf->addTTFfont('/path-to-font/DejaVuSans.ttf', 
                                'TrueTypeUnicode', '', 32);

Post a Comment for "How To Embed Fonts Into A PDF With TCPDF?"