#22668 [Opn]: printer_write() doesn't work when you manipulate on text to be written
| From: | rauf at ug dot bcc dot bilkent dot edu dot tr | Date: | Thu, 13 Mar 2003 00:21:22 +0000 |
| Subject: | #22668 [Opn]: printer_write() doesn't work when you manipulate on text to be written | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-35474@lists.php.net to get a copy of this message | ||
ID: 22668
User updated by: rauf at ug dot bcc dot bilkent dot edu dot tr
Reported By: rauf at ug dot bcc dot bilkent dot edu dot tr
Status: Open
Bug Type: Unknown/Other Function
Operating System: Windows 2000
PHP Version: 4.3.1
New Comment:
?/ should be */ in the previous post
Previous Comments:
------------------------------------------------------------------------
[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