RE: [PHP-WIN] Re: pdflib put a image to a pdf file
| From: | Jason Hoover | Date: | Wed, 14 Feb 2001 14:14:24 +0000 |
| Subject: | RE: [PHP-WIN] Re: pdflib put a image to a pdf file | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-5563@lists.php.net to get a copy of this message | ||
Rainer,
Here is sample code for placing a .jpg image in pdf. Anyone out there get
.gif images to work. I tried the code below without results (PHP Version
4.0.4pl1 running as cgi on Win NT).
$fp = fopen("test.pdf", "w"); // pdf file to be
created
$pdfObject = PDF_open($fp); // creation
of pdf oblject
PDF_begin_page($pdfObject, $pageWidth, $pageHeight); // Start First Page
PDF_add_outline($pdfObject, "Page 1"); // Add Bookmark for
Indexing
// JPG example
$im = PDF_open_jpeg($pdfObject, "imageName.jpg"); // Assign image to
variable
pdf_place_image($pdfObject, $im, 100, 300, 1); // Place image
pdf_close_image($pdfObject, $im); // close image
// GIF example
$im = PDF_open_gif($pdfObject, "apache_pb.gif"); // Assign image to variable
pdf_place_image($pdfObject, $im, 100, 300, 1); // Place image
pdf_close_image($pdfObject, $im); // close image
PDF_end_page($pdfObject); // End Page
PDF_close($pdfObject); // Close PDF Object
fclose($fp); // Close PDF File
Jason Hoover
Web Application Programmer
Entolo
2299 Territorial Road
St. Paul, MN 55114
Phone: 763.847.8022
Fax: 763.642.1600
jhoover@entolo.com
www.entolo.com
-----Original Message-----
From: Rainer Schaaf [mailto:rjs@pdflib.com]
Sent: Thursday, February 14, 2002 4:06 AM
To: php-windows@lists.php.net
Cc: glenn.lindgren@sverige.nu
Subject: [PHP-WIN] Re: pdflib put a image to a pdf file
> Hallo!
> I got this problem, I can't insert a image to the pdf
> document. I useing " pdf_place_image($pdfdoc, "test.gif", 100, 100, 1); "
> Is it anybody got a tip..
>
You should first open the image with pdf_open_image_file pdf_place_image
expects a handle to an already opend image. The PDFlib manual which
comes with the PDFlib sourcedistribution contains some examples.
> Best regards.
> //Glenn
>
> ................................................................
> 80.000 svenskar har nu gratis e-post på Sverige.nu!
>
--
Rainer Schaaf rjs@pdflib.com http://www.pdflib.com
_______PDFlib - a library for generating PDF on the fly________