LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-02-2010, 12:17 PM   #1
khriz
LQ Newbie
 
Registered: Jan 2010
Posts: 7

Rep: Reputation: 0
Printing to a Zebra printer using a php aplication web


Hi Everyone!!

I have a web page with php and xajax, and I'm trying to generate a barcode, and send it to a Zebra printer. I have no problems with the barcode, the issue here is, how can I send this barcode to the Zebra printer.

In the client side, if I type lpr -Praw file.txt, it works. But how can I do the same in my php web page?

I hope you guys can help me!!

Thanks in advance!
 
Old 02-03-2010, 12:50 PM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

Is the printer connected to the server or the to clients? If it's the server you can just use shell_exec or similar. But if it's the client it's a little more tricky. You can Javascript's window.print() but if it's text you can't use Javascript, so I think you will need to put the text in a (i)frame and then do something like "top.frames.frameName.print()". The frame can be hidden on the page. Also, it will not actually print, but bring up a box where people will have to click Ok. If webpages could print themselves, it would be too annoying.
 
Old 02-03-2010, 01:05 PM   #3
khriz
LQ Newbie
 
Registered: Jan 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for answer.

The printer is connected to the clients. In deed, I'm trying to do it like this:
"lpr -P printer user@hostname < file_to_print"

where the "file_to_print" is the file created in the server.

Do you have any other better idea?

Thanks!!
 
Old 02-03-2010, 01:33 PM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hmm

So all the clients are printer servers? Then it has nothing to do with php or web pages. You can send the job to their server, but I think you need something like - H $_SERVER['REMOTE_ADDR'] and -U $username and so on. I'd play with the command line and read man lpr and so on. If you can "mess" with the clients, it could be easier to just set up ssh keys to all of them so you can execute commands from the server. Then you could just shell_exec("ssh $hostname lpr -Praw <file_to_print").
 
1 members found this post helpful.
Old 02-04-2010, 07:58 AM   #5
khriz
LQ Newbie
 
Registered: Jan 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks Guttorm

I think I'll do it, this way. There's no problem for me to set up ssh keys on clients.

Thanks again.
 
Old 02-04-2010, 12:28 PM   #6
khriz
LQ Newbie
 
Registered: Jan 2010
Posts: 7

Original Poster
Rep: Reputation: 0
How can I put "SOLVED" this thread?
 
Old 02-22-2012, 11:36 PM   #7
FatButtLarry
LQ Newbie
 
Registered: Oct 2004
Posts: 24

Rep: Reputation: 15
I still feel this is relevant to the OPs question, but this is a browser applet that seems to do as described. Hope it will help some future Google searches:

http://code.google.com/p/jzebra/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Network printing with the Zebra LP2844 (lpr) Poetics Linux - Hardware 1 09-28-2007 12:35 AM
Zebra bar code printer Model 2746e wnguza Linux - Software 2 07-20-2006 12:58 AM
Printing with PHP/Javascript on web tooparam Linux - Software 1 01-29-2006 10:36 AM
web aplication problems jaggedsphere Linux - Newbie 3 03-28-2004 09:49 PM
Zebra printer esael Linux - Hardware 0 10-14-2002 10:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration