ID: 14283 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Unknown/Other Function Operating System: WinXP ger PHP Version: 4.0.6 New Comment:
The original code presented by joerglklein will not print at all for me. I get the same errors on both Win 98 and Win NT 4 SP4 using a Generic Text driver as well as a printer specific driver. I found if I put the printer_create_dc() and printer_set_option() outside of printer_start_doc() and printer_start_page() that it did print without most errors, but of course it didn't print correctly. Previous Comments: ------------------------------------------------------------------------ [2001-11-29 10:43:25] [EMAIL PROTECTED] 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 this bug report at http://bugs.php.net/?id=14283&edit=1