#14283 [Opn]: printer_create_dc - Example has errors in manual
| From: | philip@php.net | Date: | Sat, 26 Apr 2003 22:00:11 +0000 |
| Subject: | #14283 [Opn]: printer_create_dc - Example has errors in manual | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969352902@lists.php.net to get a copy of this message | ||
ID: 14283
Updated by: philip@php.net
Reported By: joergklein at web dot de
Status: Open
Bug Type: Documentation problem
Operating System: WinXP ger
PHP Version: 4.3.1
New Comment:
I vote we move the printer docs into the pear pecl manual.
Previous Comments:
------------------------------------------------------------------------
[2003-04-06 06:55:13] sniper@php.net
Yes, that printer extension is in PECL now..and pretty
much abandoned too. Some people requested that it should
be still included in the PHP release packages still.
------------------------------------------------------------------------
[2003-03-29 10:00:21] betz@php.net
Version info changed
The printer extension is still available for 4.3.1
Is it really moved to PECL?
As long as the docs are not moved, and printer extension will be
continued to be distributed with the 'main release' of PHP the docs
should be updated.
------------------------------------------------------------------------
[2002-12-19 23:19:48] iliaa@php.net
Appears to be an abandoned PECL extension.
------------------------------------------------------------------------
[2002-05-16 21:07:46] mtntrip at yahoo dot com
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 at web dot de
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