简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM