Search code examples
fpdfeps

Getting constant error when using FPDF with eps extension


I am having a problem with fpdf and its eps extension that I can't seem to get past it. This is what my code looks like:

define('FPDF_FONTPATH','fpdf/font/');
require('fpdf/fpdf_eps.php');
$pdf = new PDF_EPS();
$pdf->AddPage();
$pdf->ImageEps("images/image.eps",50,100);
$pdf->AddPage();
$pdf->SetFont('Arial','B',14);
$pdf->MultiCell(0,5,"some text with multiple lines");
$pdf->Output("filname.pdf", "D");

And this is what I constantly get:

Strict Standards: Only variables should be passed by reference in (...php file and line...)

FPDF error: Could not include font metric file

Any help will be greatly appreciated.

The eps extension can be found here: http://valentin.dasdeck.com/fpdf/fpdf_eps


Solution

  • About Strict Standards: Only variables should be passed by reference in (...php file and line...)

    This means what it says.. You can only hand variables by reference (the & characters before arguments in the function definition). You can either lose the & or make sure error_reporting() does not include E_STRICT, which will suppress this warning. (at any rate php should just copy whatever you pass to that function instead of handing over a reference to it so i wouldn't worry about it)

    Regarding: FPDF error: Could not include font metric file

    This error is related to SetFont(). There should be a .ufm or .afm file for Arial (or whatever font you want to load) in the font path so fpdf can load and use them.