3

I'm using FPDF to generate PDF file on my website.

Everything worked perfectly until today. PDF files are created but there is no text on it.

I tried a very simple code but it is still working :

<?php
include('fpdf.php');

$pdf = new FPDF("P");
$pdf->AddPage();

$pdf->SetY(80);

$pdf->SetFont('Arial','B',24);
$pdf->Cell(0,10,'FACTURE N°',1,0,'C');

$pdf->Output();

I didn't change any configuration on my website.

Do you know how can I fix it?

Thank you.

ThBM
  • 71
  • 5
  • Check if the font exists. Also try to add the font `$pdf->AddFont( 'Arial', '' );` before you set it. I am using slightly different PDF library but my experience is that you either do not have font set up or you are trying to render a symbol which does not exist in given font – Pavel Janicek Jul 13 '17 at 09:26
  • I tried to use AddFont() and I also tried to change Arial to Courier but the result is still the same. Also, in my example there is no symbol that should not exist in these 2 fonts. – ThBM Jul 13 '17 at 09:41
  • 1
    OK, next idea is to force it to load the font from ttf file. See this question on how to do it: https://stackoverflow.com/questions/5263588/how-to-implement-custom-fonts-in-tcpdf – Pavel Janicek Jul 13 '17 at 09:44

0 Answers0