Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FPDF error: Could not include font metric file

I have a app which was done by someone else and now i am asked to look into one issue.

When a pdf report is generated it throws an error. This app uses FPDF to generate the PDF

FPDF error: Could not include font metric file

Earlier it was throwing the following error

Warning: FPDF::include(helveticab.php) [function.FPDF-include]: failed to open stream: No such file or directory 
Warning: FPDF::include() [function.include]: Failed opening 'helveticab.php' for inclusion 
FPDF error: Could not include font metric file

This was resolved by including a font folder with helveticab.php and other php files related to other fonts

But the Error FPDF error: Could not include font metric file is still there. On searching the net the possible reasons were

  1. font directory missing

  2. Doesnt have access permissions for the font files.

I am not sure what permission need to given to the font folder or files in the folder. Any help in this regard would be of great help.

like image 648
Prady Avatar asked Jun 29 '11 12:06

Prady


1 Answers

I had the same issue. The issue was the path was incorrect to the folder with all of the fonts. So, I added updated the following line in the PHP file to reflect the correct path to the folder with all of the fonts.

define('FPDF_FONTPATH','class/fpdf_font/');

So, double check the path that this line defines, and it should work fine.

like image 52
Rasta Avatar answered Sep 20 '22 12:09

Rasta