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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.