RE: [PHP] jpg to pdf using fpdf
| From: | Peter Lauri | Date: | Wed, 26 Jul 2006 08:39:00 +0000 |
| Subject: | RE: [PHP] jpg to pdf using fpdf | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239810@lists.php.net to get a copy of this message | ||
This is code how it works for me:
$pdf =& new FPDF('p','pt','a4');
$pdf->AddPage();
$pdf->Image("pdf/profilechart.png",145,$pdf->GetY());
$pdf->Output("pdf/temp/thepdf.pdf",'F');
Add the $pdf->AddPage(); and it might work :)
-----Original Message-----
From: nicolas figaro [mailto:nfigaro@sdv.fr]
Sent: Wednesday, July 26, 2006 8:24 PM
To: PHP List
Subject: [PHP] jpg to pdf using fpdf
Hi,
I'd like to convert a jpg image to a pdf document using the fpdf class.
(www.fpdf.org).
here is the code :
<?php
require("fpdf.php");
$image="/pat/to/image.jpg";
$pdf = new FPDF();
$pdf->open();
$pdf->image($image,0,0);
$pdf->Output("/path/to/image.pdf",'F');
?>
but I only get a blank a4 pdf document when I open image.pdf using
acroread.
does anyone have an idea how I can convert a jpg to a pdf ? (without
paying if possible
the price for a commercial library).
thanks
N F