#22668 [NEW]: printer_write() doesn't work when you manipulate on text to be written

2003-03-12 Thread rauf at ug dot bcc dot bilkent dot edu dot tr
From: rauf at ug dot bcc dot bilkent dot edu dot tr
Operating system: Windows 2000
PHP version:  4.3.1
PHP Bug Type: Unknown/Other Function
Bug description:  printer_write() doesn't work when you manipulate on text to be 
written

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 bug report at http://bugs.php.net/?id=22668edit=1
-- 
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22668r=trysnapshot
Fixed in CVS:   http://bugs.php.net/fix.php?id=22668r=fixedcvs
Fixed in release:   http://bugs.php.net/fix.php?id=22668r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22668r=needtrace
Try newer version:  http://bugs.php.net/fix.php?id=22668r=oldversion
Not developer issue:http://bugs.php.net/fix.php?id=22668r=support
Expected behavior:  http://bugs.php.net/fix.php?id=22668r=notwrong
Not enough info:http://bugs.php.net/fix.php?id=22668r=notenoughinfo
Submitted twice:http://bugs.php.net/fix.php?id=22668r=submittedtwice
register_globals:   http://bugs.php.net/fix.php?id=22668r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22668r=php3
Daylight Savings:   http://bugs.php.net/fix.php?id=22668r=dst
IIS Stability:  http://bugs.php.net/fix.php?id=22668r=isapi
Install GNU Sed:http://bugs.php.net/fix.php?id=22668r=gnused



#22668 [Opn]: printer_write() doesn't work when you manipulate on text to be written

2003-03-12 Thread rauf at ug dot bcc dot bilkent dot edu dot tr
 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=22668edit=1