Satyajeet
Satyajeet

Reputation: 47

How to set font path in FPDF

I'm getting the following error:

include(/gravity/school/pdf/font/helveticab.php): failed to open stream: No such file or directory in C:\xamp\htdocs\gravity\school\pdf\fpdf.php on line 1144

Can anyone tell me how to set the fontpath?

Upvotes: 2

Views: 6871

Answers (1)

Maitray Suthar
Maitray Suthar

Reputation: 273

You can place font file anywhere in your project folder, the best way to place font file is fpdf/fonts, Where fpdf is your library folder which you are using to generate PDFs. Then after set the fonts as below:

define('FPDF_FONTPATH','/Path/to/font');
require('fpdf.php');

// Arial bold 14
$pdf->SetFont('Arial','B',14);

You can refer official doc for more information: SetFont FPDF

Upvotes: 4

Related Questions