note 11248 added to PDF functions
| From: | grant at -conprojan dot com dot au | Date: | Tue, 13 Feb 2001 00:58:00 +0000 |
| Subject: | note 11248 added to PDF functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-10954@lists.php.net to get a copy of this message | ||
pdf_new() is not a valid function with php compiled with with pdflib 3.03 support. It just
doesn't exist in my installation, but all other functions are present.
Instead try the following example given to me by `brian on efnet #PHP:
<?
header( "Content-type: application/pdf" );
$f = fopen("test", "w");
$pdf = PDF_open($f);
pdf_set_info_author($pdf, "Luca Perugini");
PDF_set_info_title($pdf, "Brochure for FlyStore");
pdf_set_info_creator($pdf, "See Author");
pdf_set_info_subject($pdf, "FlyStore");
PDF_begin_page($pdf, 595, 842);
PDF_add_outline($pdf, "Item".$data[1]);
pdf_set_font($pdf, "Helvetica-Bold" , 20, winansi);
pdf_set_text_rendering($pdf, 0);
pdf_show_xy($pdf, "OMG its a pdf on the fly!",50,780);
if (!isset($name)) {
$name = "Test Name";
}
if (!isset($age)) {
$age = "Test Age";
}
PDF_show_xy($pdf, "Your Name : $name" .$data[1], 100, 700);
PDF_show_xy($pdf, "Age : $age" .$data[2], 100, 620);
pdf_stroke($pdf);
PDF_end_page($pdf);
PDF_close($pdf);
fclose($f);
header("Content-length: " . filesize("test"));
$f = fopen("test", "r");
fpassthru($f);
fclose($f);
?>
http://www.php.net/manual/en/ref.pdf.php