Re: need advice on project...
| From: | Rasmus Lerdorf | Date: | Tue, 24 Jul 2001 23:34:24 +0000 |
| Subject: | Re: need advice on project... | ||
| References: | 1 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-59453@lists.php.net to get a copy of this message | ||
> Does any one have any good code for creating PDF's on the fly with graphic
> images?
Putting an image in a PDF is trivial:
<?
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_begin_page($pdf, 612, 792); // US-Letter size
$x = 5; $y = 792-72;
$scale = 0.5;
$im = pdf_open_jpeg($pdf, "logo.jpg");
pdf_place_image($pdf, $im, $x, $y, $scale);
pdf_close_image ($pdf,$im);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header('Content-disposition: inline; filename=fax.pdf');
header('Content-length: ' . strlen($data));
echo $data;
?>
-Rasmus