[PHP-DOC] #14283 [Opn->Sus]: printer_create_dc - Example has errors in manual From: iliaa <email protected>
Date: 12/20/02

 ID: 14283
 Updated by: iliaa <email protected>
 Reported By: joergklein <email protected>
-Status: Open
+Status: Suspended
 Bug Type: Documentation problem
 Operating System: WinXP ger
 PHP Version: 4.0.6
 New Comment:

Appears to be an abandoned PECL extension.

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

[2002-05-16 21:07:46] mtntrip <email protected>

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.

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

[2001-11-29 10:43:25] joergklein <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

-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php