#22668 [Com]: printer_write() doesn't work when you manipulate on text to be written
| From: | dave at mail dot slh dot wisc dot edu | Date: | Mon, 11 Aug 2003 17:20:04 +0000 |
| Subject: | #22668 [Com]: printer_write() doesn't work when you manipulate on text to be written | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-19516@lists.php.net to get a copy of this message | ||
ID: 22668
Comment by: dave at mail dot slh dot wisc dot edu
Reported By: rauf at ug dot bcc dot bilkent dot edu dot tr
Status: Assigned
Bug Type: PEAR related
Operating System: Windows 2000
PHP Version: 4.3.1
Assigned To: fmk
New Comment:
I am using version 4.3.3RC3 IIS5 on Win2K. When running php in CGI mode
I get the "couldn't allocate the printerjob" error, however when
running as an ISAPI printer_write() functions without error.
Previous Comments:
------------------------------------------------------------------------
[2003-04-28 04:50:37] mj@php.net
Frank M. Kromann (-> Assigned)
------------------------------------------------------------------------
[2003-04-28 03:53:57] arnaud@php.net
Who is this extension maintainer ?
------------------------------------------------------------------------
[2003-03-12 19:07:32] iliaa@php.net
This extension is now part of the PECL repository.
------------------------------------------------------------------------
[2003-03-12 18:21:21] rauf at ug dot bcc dot bilkent dot edu dot tr
?/ should be */ in the previous post
------------------------------------------------------------------------
[2003-03-12 18:20:15] rauf at ug dot bcc dot bilkent dot edu dot tr
This function (printer_write()) runs perfectly when i use the
following:
ob_start();
/* put some data on the screen ?/
echo("some text to be written\n");
echo("some other text to be written\n");
echo("another text to be written\n");
$handle = printer_open("Panasonic KX-P1150");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_set_option($handle, PRINTER_COPIES, 1);
$string = ob_get_contents();
/* I'm using the data on the screen buffer */
printer_write($handle, $string);
printer_close($handle);
I have the following error message when i use the following code:
Warning: couldn't allocate the printerjob [1804] in
c:\apache\htdocs\... on line 148
the code is:
----------------
ob_start();
/* put some data on the screen ?/
echo("some text to be written\n");
echo("some other text to be written\n");
echo("another text to be written\n");
$handle = printer_open("Panasonic KX-P1150");
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_set_option($handle, PRINTER_COPIES, 1);
$string = ob_get_contents();
/* I'm using the data on the screen buffer */
replaceTurkish($string)
/* this time i'm using this function that replaces
the Turkish characters with the English ones.
The function is given below */
printer_write($handle, $string);
printer_close($handle);
--------------------
function replaceTurkish(&$text)
{
$text = str_replace("Ð", "G", $text);
$text = str_replace("Ü", "U", $text);
$text = str_replace("Þ", "S", $text);
$text = str_replace("Ý", "I", $text);
$text = str_replace("Ö", "O", $text);
$text = str_replace("Ç", "C", $text);
$text = str_replace("ð", "g", $text);
$text = str_replace("ü", "u", $text);
$text = str_replace("þ", "s", $text);
$text = str_replace("ý", "i", $text);
$text = str_replace("ö", "o", $text);
$text = str_replace("ç", "c", $text);
}
----------------------------------
The same error occurs when I use:
printer_write($handle, "$string");
instead of
printer_write($handle, $string);
-----------------------------------
I've seen some similar bug reports closed because of the PHP version is
too old. I used the latest stable version but the same problem occurs.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22668&edit=1