I have bunch of images and I want to generate PDF of of all those images. I am using FPDF
library (version 1.7) for achieving this. But I am getting the following e
I had this kind of problem and my issue was that I was using a linux web server and I made the mistake of not using the correct case in my references to my font files. After I changed "Arial" to "arial" the problem was resolved.
Maybe a bit too late, but I used to have that same problem and the solution was to simply give permissions to the /font/ folder...
Rookie mistake... 755 permissions did the trick for me.
I had a similar error and i share here because there is no documentation online.
"FPDF error: Font file not found"
If you convert a ttf font file for use it in FPDF with the online utility (http://fpdf.fruit-lab.de) once you have downloaded the files you need (file.php, file.afm, file.z) you'll have to:
1) put in font folder (or any other folder, but you should use this instruction define('FPDF_FONTPATH','yourpath/yourfolder/');
)
2) If you RENAME the files, you should open the file.php and search for "$file" which contains the name of the ".z" file and rename it properly.
Check your font path in AddFont function.
For example:
$fontInformation = pathinfo(WWW_ROOT . "files/files/font/file/" . $pdffile['font_file']);
$fontFileName = $fontInformation['filename'] . '.php';
//$pdf->fontpath = WWW_ROOT . "files/font/file/";
$pdf->AddFont($fontInformation['filename'], '', $fontFileName);
//set font for the entire document
$pdf->SetFont($fontInformation['filename'], '', 20);
This may solve your problem.
You must create the font definition files for the fonts you are using.
See here:
http://www.fpdf.de/tutorials/7/
define('FPDF_FONTPATH','font/');
check in above line for correct path from local folder to server.....
exactly it runs well
define('FPDF_FONTPATH','font/');
require('fpdf.php');
class PDF extends FPDF
{
//Constructor (mandatory with PHP3)
function PDF()
{
self::__construct();
}
public function __construct()
{
$this->FPDF();
}
//Page header
function Header()
{
//Logo
//$this->Image('logo_pb.png',10,8,33);
//Arial bold 15
$this->SetFont('Arial','B',15);
//Move to the right
$this->Cell(80);
//Title
$this->Cell(30,10,'Title',1,0,'C');
//Line break
$this->Ln(20);
}
//Page footer
function Footer()
{
//Position at 1.5 cm from bottom
$this->SetY(-15);
//Arial italic 8
$this->SetFont('Arial','I',8);
//Page number
$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
}
}
echo "<br/>";
//Instanciation of inherited class
$pdf=new PDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$pdf->Image('logo_pb.png',40,20,33);
$url="demo/ivv/doc.pdf";
$dir='C:/xampp/htdocs/laravel/public/pdf/';
$filename= time().'.pdf';
$content=$pdf ->Output($dir.$filename);
?>