How to add fonts using tFPDF

自作多情 提交于 2019-12-08 07:40:36

问题



I try to create pdf file using tFPDF with custom font.
I put arial font inside font/unifont folder.
I use this code to create pdf file:

$pdf->AddFont('arialbd','','arialbd.ttf',true);

$pdf->SetFont('arialbd','',16);
$pdf->Cell(40,6, 'OÜ Kersti Võlu Koolituskeskus', 0, 1);

$pdf->SetFont('arialbd','',10);
$pdf->Cell(40,12,'REGISTREERIMISLEHT', 0, 1);

$pdf->Output('test.pdf', 'I');

It works well on localhost, but when I uploaded this file on server, it shows me an error:

Warning: fopen(C:\xampp\htdocs\koolitus\wp-content\plugins\koolitus\fpdf/font/unifont/arialbd.ttf)

I see that library tries to load a font from my localhost, but I don't even set a path, just use font name
How to add fonts properly?


回答1:


Delete all *.php and *.dat files in font/unifont folder except ttfonts.php. All this files will be re-created (with right path).



来源:https://stackoverflow.com/questions/38513082/how-to-add-fonts-using-tfpdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!