From: joergklein@web.de
Operating system: WinXP ger
PHP version: 4.0.6
PHP Bug Type: Unknown/Other Function
Bug description: printer_create_dc - Example has errors in manual
take a look at
http://www.php.net/manual/en/function.printer-create-dc.php
at first you should replace printer_endpage($handle); with
printer_end_page($handle);
his is the correct code:
01: <?$handle = printer_open();
02: printer_start_doc($handle);
03: printer_start_page($handle);
04:
05: printer_create_dc($handle);
06: /* do some stuff with the dc */
07: printer_set_option($handle, PRINTER_TEXT_COLOR, "333333");
08: printer_draw_text($handle, 1, 1, "text");
09: printer_delete_dc($handle);
10:
11: /* create another dc */
12: printer_create_dc($handle);
13: printer_set_option($handle, PRINTER_TEXT_COLOR, "000000");
14: printer_draw_text($handle, 1, 1, "text");
15: /* do some stuff with the dc */
16:
17: printer_delete_dc($handle);
18:
19: printer_end_page($handle); <----- the coorect line
20: printer_end_doc($handle);
21: printer_close($handle);
22: ?>
Second: when I tried out this example I get an one error and one warning:
Warning: couldn't end the page in /test.php on line 19
Fatal error: couldn't terminate print job in /test.php on line 20
When I try to open a special printer with
$handle = printer_open("$printer");
I get these errors and warnings:
Warning: No DeviceContext created in /test.php on line 17
Warning: couldn't end the page in /test.php on line 19
Fatal error: couldn't terminate print job in /test.php on line 20
So I think there a some problems with the Device Contexts
Joerg
--
Edit bug report at: http://bugs.php.net/?id=14283&edit=1