Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FPDF error: Could not include font definition file in PHP

Tags:

php

fpdf

I have bunch of images and I want to generate PDF of of all those images. I am using FPDF library (version 1.7) for achieving this. But I am getting the following error:

FPDF error: Could not include font definition file

I found some articles on google regarding this error and tried that but still problem persist.

What should be the problem here? Where I am going wrong?

like image 831
J.K.A. Avatar asked Sep 18 '25 14:09

J.K.A.


2 Answers

I had a similar error and i share here because there is no documentation online.

"FPDF error: Font file not found"

If you convert a ttf font file for use it in FPDF with the online utility (http://fpdf.fruit-lab.de) once you have downloaded the files you need (file.php, file.afm, file.z) you'll have to:

1) put in font folder (or any other folder, but you should use this instruction define('FPDF_FONTPATH','yourpath/yourfolder/');)

2) If you RENAME the files, you should open the file.php and search for "$file" which contains the name of the ".z" file and rename it properly.

like image 148
cbologna Avatar answered Sep 21 '25 07:09

cbologna


Maybe a bit too late, but I used to have that same problem and the solution was to simply give permissions to the /font/ folder...

Rookie mistake... 755 permissions did the trick for me.

like image 32
Diogo Silva Avatar answered Sep 21 '25 07:09

Diogo Silva