2

I'm trying to find the best approach to send data to print (Thermal and HP laser A4) connected to my Ubuntu system.

I can access printer by writing in /dev/usb/lp*. What is the best approach to do it using c++ as programming language.

Thanks,

Lhoussaine
  • 59
  • 1
  • 11
  • Accessing the device directly is always a bad idea, you should use some configuration value that let you control the sending to a printer spooling system (lpr/lp). – Jean-Baptiste Yunès Mar 01 '16 at 12:28

1 Answers1

4

As Ubuntu and a lot of other Linux distros use CUPS as printing system, I would recommend that your app only communicates with CUPS. Like that you can avoid having to implement printer specific stuff, but you have a generic way that should work on any Linux distro supporting cups.

See here for a handy example for printing using cups: Linux/CUPS printing example/tutorial?

Community
  • 1
  • 1
erg
  • 1,632
  • 1
  • 11
  • 23
  • 1
    CUPS [official documentation](http://www.cups.org/documentation.php/api-overview.html) for reference. (Looking that link up first allowed you to ninja the answer. ;-) ) – DevSolar Mar 01 '16 at 12:35
  • What i have done using CUPS is taking a simple example from CUPS documentation and try to send RAW data to thermal printer, but printer don't recognize CUPS job. – Lhoussaine Mar 03 '16 at 08:54