Page 1 of 1

'Metrics data for font 'Times New Roman' not found'

PostPosted: 27. February 2005 01:24
by cretum
i am using php for a while and now in a project i have to generate some pdf files from a database. i started looking for a solution and i fount out that pdflib is the best but i can t make it work. i did some copy/paste examples to understand how it works but all i received is this error:

Fatal error: Uncaught exception 'PDFlibException' with message 'Metrics data for font 'Times New Roman' not found' in H:\test\index.php:10 Stack trace: #0 {main} thrown in H:\test\index.php on line 10


source code:
<?
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
//pdf_add_outline($pdf, "Page 1");
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
pdf_setfont($pdf, $font, 10);
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
echo "<A HREF=getpdf.php>finished</A>";
?>

if anyone has any ideea please post here or contact me on yahoo messenger, id: mihai_22_23. thank you all!!!

PDF using PHP Font Issue Fixed

PostPosted: 10. December 2007 14:02
by mmkader85
Instead of this piece :cry: :cry: :cry:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
pdf_setfont($pdf, $font, 10);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Try this piece :lol: :lol: :lol:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$font = PDF_load_font($pdf, "Courier","iso8859-1","");
pdf_setfont($pdf, $font, 10);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

PDF Core Fonts are listed below:
- Courier
- Courier-Bold
- Courier-Oblique
- Courier-BoldOblique
- Helvetica
- Helvetica-Bold
- Helvetica-Oblique
- Helvetica-BoldOblique
- Times-Roman
- Times-Bold
- Times-Italic
- Times-BoldItalic
- Symbol
- ZapfDingbats

:!: Reference: http://in.php.net/pdf_load_font