Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP and PDF: problem with font metrics data

Posted on 2004-04-13
6
Medium Priority
?
3,607 Views
Last Modified: 2013-12-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:

<?php
$pdf = pdf_new();
pdf_set_parameter($pdf, "resourcefile", "c:\php\pdf-related\pdflib.upr");
pdf_open_file($pdf, "dummy.pdf");
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);
pdf_end_page($pdf);
pdf_close($pdf);
?>

I have specified the afm and pfm filename for my font in the pdflib.upr file:
FontAFM
Free3of9Extended=New_____.afm
...
FontPFM
Free3of9Extended=New_____.pfm

(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?

Thanks guys/gals!
0
Comment
Question by:muntel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 9

Expert Comment

by:techtonik
ID: 10816908
No idea. Could you try latest PDFlib from http://www.pdflib.com/products/pdflib4/download/PHP-4.3.0/pdflib-4.0.3-Windows-php430.zip or version 5 http://www.pdflib.com/products/pdflib/index.html

I've got some crashes with PDFlib, which comes with PHP 4.3.4
0
 

Author Comment

by:muntel
ID: 10820614
Thank you for answering, techtonik. I gave it a try with the new version of PDFlib, but I still get the same error.

I don't think my problem has anything to do with PDFlib, it may have something to do with the font I'm using (barcode 3 of 9). Does anybody have some experience with using fonts in PDF files? Anyone, please?
0
 

Author Comment

by:muntel
ID: 10822142
It's OK, I've solved the problem. I switched from Type 1 to True Type for my barcode fonts and everything works fine.

I modified the pdflib.upr file accordingly:

FontOutline
Free 3 of 9 = Free3of9.ttf

Now things work just the way they should.

I'd like a refund on my points, if that's possible, please. Thanks!
0
 
LVL 9

Expert Comment

by:techtonik
ID: 10826624
Agreed. =)
You should make a request as it stated here.
http://www.experts-exchange.com/Web/Web_Languages/PHP/PHP_Windows/help.jsp#hi70
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 10830520
User resolved; closed, 125 points refunded.

Netminder
Site Admin
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question