anuprathap Posted December 20, 2007 Share Posted December 20, 2007 I am trying to print barcodes from my application. When i try this using javascript it prints the entire page onto the barcore paper including Pagenumber and Page URL. So I used printer_write() so that i could get only the Barcode printed. But now I get an error Warning: printer_write() [function.printer-write]: couldn't allocate the printerjob [5] in C:\apache\xampp\htdocs\test\printer_fns.php on line 15 The printer is connected to the client machine, but shared and accesible by the server. The printer prints fine when i give a test print from the server. I have been battling with this for more than a week. I would really apreciate is anyone could help me with getting only the Barcode image printed on the barcode printer - does not matter if it through javascript or PHP or any other method any of you have done the same before. Thanks in Advance. Regrds, AP Quote Link to comment https://forums.phpfreaks.com/topic/82523-printer_write-error/ Share on other sites More sharing options...
chigley Posted December 20, 2007 Share Posted December 20, 2007 Paste your code? Quote Link to comment https://forums.phpfreaks.com/topic/82523-printer_write-error/#findComment-419495 Share on other sites More sharing options...
anuprathap Posted December 21, 2007 Author Share Posted December 21, 2007 Sorry chigley ... I didnt give my code in my post. Here it is.... if($handle = printer_open("\\\\Server_name\\printer_name")) { echo "Connected to "; print_r($handle); printer_set_option($handle, PRINTER_MODE, "RAW"); printer_write($handle, "Text to print"); } else { echo "Cannot connect to "; print_r($handle); } Error message: Connected to Resource id #2 Warning: printer_write() [function.printer-write]: couldn't allocate the printerjob [5] in C:\apache\xampp\htdocs\test\printer_fns.php on line 15 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/82523-printer_write-error/#findComment-420270 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.