php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #14283 printer_create_dc - Example has errors in manual
Submitted: 2001-11-29 10:43 UTC Modified: 2004-04-03 10:37 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:4 (80.0%)
From: joergklein at web dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.1 OS: WinXP ger
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: joergklein at web dot de
New email:
PHP Version: OS:

 

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-16 21:07 UTC] 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.
 [2002-12-19 23:19 UTC] iliaa@php.net
Appears to be an abandoned PECL extension.
 [2003-03-29 10:00 UTC] 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.
 [2003-04-06 06:55 UTC] 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-04-26 17:00 UTC] philip@php.net
I vote we move the printer docs into the pear pecl manual.
 [2003-04-26 17:06 UTC] alindeman@php.net
+1 Anyone who has karma want to do this?
 [2003-04-26 17:17 UTC] philip@php.net
I've long promised to create an RFC that details ways to deal with possible 404's after a move (ex. php.net/printer-create-dc) but have yet to create such a beast although this discussion doesn't belong in a bug report.  Unfortunatly there's a lot more involved then simply mving files.

When the time comes I can move this extension.
 [2004-04-03 10:37 UTC] nlopess@php.net
The example is already fixed, althought the docs weren't moved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 04:01:29 2024 UTC