Marc Salvetti
Marc Salvetti

Reputation: 362

How to stream data from file to netcat for printing?

I'm using openbravo pos to print on thermal printer using a linux device. For example I have a printer plugged in usb port, I point the properties file to /dev/usb/lp0 and it prints perfectly, providing that the user has the write permissions on the dev of course.

Now I would like to print on a similar printer, but using raw mode on port 9100. I have found that both commands are working fine, which is good news

echo "hello" | nc 192.168.0.5 9100 
echo "hello" > /dev/tcp/192.168.0.5/9100

My problem is that openbravo doesn't recognize any of those syntaxes in the settings.

So I'm thinking there must be a way to do a mapping from a mount point, for example /tmp/lp to the netcat command and to make that mapping happen at system level so that I can just point openbravo to print on /tmp/lp ?

For the analogy, I was able to achieve the same purpose in windows using the following command

net use lpt1: \\user-pc\printer /persistent:yes

Upvotes: 2

Views: 1414

Answers (0)

Related Questions