RE: jpg to pdf using fpdf

RE: jpg to pdf using fpdf

am 26.07.2006 10:26:28 von Peter Lauri

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: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 :

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: jpg to pdf using fpdf

am 26.07.2006 10:34:20 von Peter Lauri

So then it was the opposite of what I had in memory :)

-----Original Message-----
From: nicolas figaro [mailto:nfigaro@sdv.fr]=20
Sent: Wednesday, July 26, 2006 8:30 PM
To: 'PHP List'
Subject: Re: [PHP] jpg to pdf using fpdf

Peter Lauri a =E9crit :
> 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.
>
> =20
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: jpg to pdf using fpdf

am 26.07.2006 10:39:00 von Peter Lauri

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 :

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: jpg to pdf using fpdf

am 26.07.2006 10:49:22 von Peter Lauri

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:nfigaro@sdv.fr]=20
Sent: Wednesday, July 26, 2006 8:44 PM
To: PHP List
Subject: Re: [PHP] jpg to pdf using fpdf

Peter Lauri a =E9crit :
> This is code how it works for me:
>
> $pdf =3D& 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 :)
>
> =20
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

jpg to pdf using fpdf

am 26.07.2006 15:23:50 von nicolas figaro

--------------080205020607060208070103
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I'd like to convert a jpg image to a pdf document using the fpdf class.
(www.fpdf.org).

here is the code :

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


--------------080205020607060208070103
Content-Type: text/plain; charset=us-ascii

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------080205020607060208070103--

Re: jpg to pdf using fpdf

am 26.07.2006 15:29:40 von nicolas figaro

--------------000405040103000009060202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

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


--------------000405040103000009060202
Content-Type: text/plain; charset=us-ascii

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------000405040103000009060202--

Re: jpg to pdf using fpdf

am 26.07.2006 15:43:48 von nicolas figaro

--------------080503000002070208020900
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

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


--------------080503000002070208020900
Content-Type: text/plain; charset=us-ascii

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------080503000002070208020900--

Re: jpg to pdf using fpdf

am 26.07.2006 17:09:54 von TedD

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 :
> >
>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