Jump to content

printer_write() Error


anuprathap

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/82523-printer_write-error/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/82523-printer_write-error/#findComment-420270
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.