RE: [PHP] jpg to pdf using fpdf
Correct me if I am wrong, but do fpdf allow jpg? I think you must convert to PNG or GIF and then use that image. -Original Message- From: nicolas figaro [mailto:[EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] jpg to pdf using fpdf
Peter Lauri a écrit : Correct me if I am wrong, but do fpdf allow jpg? I think you must convert to PNG or GIF and then use that image. I correct you. FPDF allow jpg. take a look at ttp://www.fpdf.org/en/doc/image.htm Supported formats are JPEG and PNG. N F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] jpg to pdf using fpdf
So then it was the opposite of what I had in memory :) -Original Message- From: nicolas figaro [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 26, 2006 8:30 PM To: 'PHP List' Subject: Re: [PHP] jpg to pdf using fpdf Peter Lauri a écrit : Correct me if I am wrong, but do fpdf allow jpg? I think you must convert to PNG or GIF and then use that image. I correct you. FPDF allow jpg. take a look at ttp://www.fpdf.org/en/doc/image.htm Supported formats are JPEG and PNG. N F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] jpg to pdf using fpdf
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:[EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] jpg to pdf using fpdf
Peter Lauri a écrit : 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 :) addpage did the trick. thanks peter. next question : how to set the pdf size to the size of the image ? :) N F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] jpg to pdf using fpdf
Check the FPDF function in the manual http://www.fpdf.org/en/doc/fpdf.htm, I think you can set custom size of the PDF. You have to figure out how to get the image size first, hint: getImageSize();), and then convert it to the units you use for the pdf. -Original Message- From: nicolas figaro [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 26, 2006 8:44 PM To: PHP List Subject: Re: [PHP] jpg to pdf using fpdf Peter Lauri a écrit : 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 :) addpage did the trick. thanks peter. next question : how to set the pdf size to the size of the image ? :) N F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] jpg to pdf using fpdf
At 3:23 PM +0200 7/26/06, nicolas figaro wrote: 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 This code from mine that works: define('FPDF_FONTPATH','font/'); require('fpdf.php'); require('PDF_Rotate.php'); require('PDF_RotPos.php'); //--- open a new page $pdf = new PDF_RotPos('L','in','Legal'); $pdf-Open(); $pdf-AddPage(); // Do Image $pdf-Image('medal.jpg',0.3,0.3,2); I use 'PDF_Rotate.php' and 'PDF_RotPos.php' because I rotate text in my PDF's hth's tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php