Ah Dii
Ah Dii

Reputation: 38

PHP Error on "Warning: printer_draw_bmp(): Failed to load bitmap"

I cannot print an image file using printer_draw_bmp() function. I already installed the php printer dll and imagick on the windows 7 (32 bits).

Here is my sample code. But I get "Warning: printer_draw_bmp(): Failed to load bitmap". Can anyone guide me to debug this?

<?php
$handle = printer_open();
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_start_doc($handle, "My Doc");
printer_start_page($handle);

$image = new Imagick();
$image->readImage("c:\\picStorage\\pic\\999-0001.jpg");
$image->setImageFormat("bmp");
$image->writeImage("C:\\test.bmp");

printer_draw_bmp($handle,"C:\\test.bmp", 300,600);

printer_end_page($handle);
printer_end_doc($handle);

printer_close($handle);

After I run the sample code, it will create a BMP image at C: directory.

The BMP image at C: directory

Upvotes: 1

Views: 748

Answers (0)

Related Questions