QT Printing via ubuntu



  • I am running QT4 in Ubuntu 10.04 and have a receipt printer , Ubuntu cannot find drivers for my printer however i have the device location /dev/usb/lp0 and i have printed out to the printer using python by treating it as a file.

    How can i print to this printer using QT/C++ without treating it as a file or installing drivers for it on my OS ? ,


  • Moderators

    I am no expert on receipt printers (you did not even give a manufacturer or model), but my guess is: No.

    /dev/usb/lp0 is the device file for a virtual parallel port. It is the only way to talk via that port. So if you need to communicate that way, then there is no way around it. Even if you install drivers those will most likely use that file.

    And with unix "everything is a file" philosophy even drivers tend to provide a file-like interface.



  • In CUPS, which is used by Ubuntu too, you can add printers attached to a lp port. You will need a decent driver (PPD file). The printer then can be used throughout the system, including Qt apps.

    If you do not have a PPD you're off to writing to /dev/usb/lp0 directly, using QFile/QDataStream/QTextStream or the like.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.