PHP and PDF: problem with font metrics data
Posted on 2004-04-13
Hi there, PHP gurus! Urgent help needed here (before I throw this wicked machine off the window:))
My application is supposed to generate a .pdf file containting some product identification data and the corresponding barcode for the product.
I have installed the Free3of9Extended font on my machine (I'm running PHP 4.3.4 with Apache on Win98) and it works just fine with HTML or MS Word (i.e. I can see and print the barcodes), but when I try using it in a PHP-generated .pdf file, I get this error:
"Fatal error: PDFlib error: Metrics data for font 'Free3of9Extended' not found in c:\localsite\test.php on line 13"
My elementary testing code looks like this:
$pdf = pdf_new();
pdf_set_parameter($pdf, "resourcefile", "c:\php\pdf-related\pdflib.upr");
pdf_begin_page($pdf, 595, 842);
$myfont = pdf_findfont($pdf, "Free3of9Extended", "host", 1);
pdf_setfont($pdf, $myfont, 10);
pdf_show_xy($pdf, "2453453452345", 50, 750);
I have specified the afm and pfm filename for my font in the pdflib.upr file:
(new_____.* are the corresponding filenames for the afm and pfm barcode font files)
I still can't get rid of the "Metrics data for font 'Free3of9Extended' not found" error message. Note that other fonts (such as Arial) work just fine.
What else do I have to do? What am I overlooking here?