help with PDF - undefined function
| From: | Jon Rosenberg | Date: | Wed, 03 Jan 2001 18:42:30 +0000 |
| Subject: | help with PDF - undefined function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32530@lists.php.net to get a copy of this message | ||
I am trying to get his sample code from the php manual to work:
I get the following error:
Fatal error: Call to undefined function: pdf_open() in
/home/sites/site5/web/pdf.php on line 3
pdf_open() is a built-in function of PHP, so I'm not sure why this isn't
working. I'm using pdflib 3.03 and PHP 4.0.3pl1 on linux. Any ideas?
I can see that it is indeed making the file in the directory, but why is
this function 'undefined'?
Jon
From the manual:
Most of the functions are fairly easy to use. The most difficult part is
probably to create a very simple pdf document at all. The following example
should help to get started. It creates the file test.pdf with one page. The
page contains the text "Times Roman outlined" in an outlined, 30pt font. The
text is also underlined.
<?php
$fp = fopen("test.pdf", "w");
$pdf = pdf_open($fp);
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");
pdf_set_font($pdf, "Times-Roman", 30, "host");
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);
fclose($fp);
echo "<A HREF=getpdf.php>finished</A>";
?>