Generating a PDF file through PHP
Posted: Wed Sep 16, 2009 6:17 am
G'day,
I have a problem, which i really dont know much about. I'm just testing the waters here, and looking at how i can export output from php to a PDF file.
I found one tutorial, but i am getting a confusing error message.
The error message that i am getting is:
Cheers
I have a problem, which i really dont know much about. I'm just testing the waters here, and looking at how i can export output from php to a PDF file.
I found one tutorial, but i am getting a confusing error message.
Code: Select all
// create handle for new PDF document
$pdf = pdf_new();
// open a file
pdf_open_file($pdf, "philosophy.pdf");
// start a new page (A4)
pdf_begin_page($pdf, 595, 842);
// get and use a font object
$arial = pdf_findfont($pdf, "Courier", "host", 1);
pdf_setfont($pdf, $arial, 10);
// print text
pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,",50, 750);
pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50,730);
// end page
pdf_end_page($pdf);
// close and save file
pdf_close($pdf);If someone could please help me to understand, it would be much appreciated!Fatal error: Uncaught exception 'PDFlibException' with message 'No file specified with outline data for font 'Courier'' in C:\wamp\www\Creating PDFs\pdf.php:20 Stack trace: #0 C:\wamp\www\Creating PDFs\pdf.php(20): pdf_findfont(Resource id #2, 'Courier', 'host', 1) #1 {main} thrown in C:\wamp\www\Creating PDFs\pdf.php on line 20
Cheers