Anthony
Anthony

Reputation: 41

How to add a custom font (Myriad Pro) on PDF with TCPDF library

I use the TCPDF library v6.2.

First, I have test to import a Myriad Pro font with this code :

\TCPDF_FONTS::addTTFfont($fontPath, 'TrueTypeUnicode');

The method respond 'false' while $fontPath is correct. I have test with an another font and this method return an array.

Next, I used a website for convert my font on tcpdf files (.z, .php ...) and I copied this on my TCPDF fonts folder. But after generated my PDF my font is not visible on the PDF. I think it's normal because in my OS Debian I don't have this font. How I can import my font with the pdf for a most compatibility ?

I use this sample code

$pdf->SetFont('myriadpro', $fontStyle, $fontSize);
$pdf->Cell($width, $height, $text);

'myriadpro' is the name of generated files (.z, .php).

Thanks,

Upvotes: 0

Views: 677

Answers (1)

Vladimir
Vladimir

Reputation: 1

In my case, three files: myfont.php, myfont.z, myfont.ctg.z

and check file permissions

Upvotes: 0

Related Questions