ID:               12021
 Comment by:       car-cartoon1137 at hotmail dot com
 Reported By:      fred at surleau dot com
 Status:           Closed
 Bug Type:         PDF related
 Operating System: Win NT 4.0
 PHP Version:      4.0.6
 New Comment:

<a href=http://l-uncut-vintage-cin.da.ru>cartoon car</a>


Previous Comments:
------------------------------------------------------------------------

[2001-10-08 13:49:09] [EMAIL PROTECTED]

Hi,

I checked this with "nesrin.jpg" from the PDFlib distribution. The
code:

<?
$file = "nesrin.jpg";
$len=filesize($file);
$fp = fopen($file, "rb");
echo $fp;
$data = fread($fp, $len);
fclose($fp);

$pdf=pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_begin_page($pdf, 745, 493);

$pim = pdf_open_image($pdf, "jpeg", "memory", $data, $len, 745, 493,
3, 8, "" );

PDF_place_image($pdf, $pim, 0, 0, 1);
PDF_close_image($pdf, $pim);
pdf_end_page($pdf);
pdf_close($pdf);
?>

It worked fine.

You have supply the correct parameters for widht/height/components/bpc
and then it should work.

If you still have problems try to contact [EMAIL PROTECTED]


------------------------------------------------------------------------

[2001-07-10 12:50:56] fred at surleau dot com

Hi,

I use PDFLIB version 4.0.1 and PHP 4.0.6.

<?
$file = "image.jpg";
$len=filesize($file);
$fp = fopen($file, "rb");
echo $fp;
$data = fread($fp, $len);
fclose($fp);

$pdf=pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_begin_page($pdf, 595, 842);

// With pdf_open_image_file() it works !
// $pim = pdf_open_image_file($pdf, "jpeg", $file");
$pim = pdf_open_image($pdf, "jpeg", "memory", $data, $len, 300, 100, 3,
8, "" );

PDF_place_image($pdf, $pim, 100, 500, 1);
PDF_close_image($pdf, $pim);
pdf_end_page($pdf);
pdf_close($pdf);
?>

The script works with no errors, and the PDF file is created.
With pdf_open_image_file() the Jpeg file is correctly mixed in the PDF
file
With pdf_open_image(), at the place in the PDF file where I should find
the Jpeg data, there is garbage starting with "C:\inetpub\wwwroot" !

I need to use pdf_open_image() instead of pdf_open_image_file() because
the image I want to use is not a file, it's created with the gd library,
and the function pdf_open_memory_image() is not available in PHP 4.0.6
binaries for Win32.

Regards.
Fred.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=12021&edit=1

Reply via email to