| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 2 | |
I'm trying to set up a special server that using my own protocol controls a locally attached printer. It's a special label printer and this is to allow client applications anywhere in the building to print out labels on this printer. This way the printer doesn't have to be shared and no drivers, etc. need to be installed on local machines. Essentially this is halfway working. My server listens, gets the commands from my protocol and does what it's supposed to do. I have one command that initializes the document, followed by data commands, followed by an end command that signals to print the label. During the initialization command, the QPrinter object is intialized and the QPainter object is initialized. The end command simply just calls end() on the QPainter and then does all other necessary cleanup. That part works. I get an empty label. The issue arises when I actually try to draw something on it. The software crashes with the following error followed by a core dump: ïlp: Error - stdin is empty, so no job has been sent. And I just don't understand why. The code was copied from a small utility that I've been using for months to print things with this printer. The very same code works perfectly fine when executed from that utility. The only difference I can see is that in the server version of the code it is being executed from within a signal (readReady) in the QTcpSocket instead of being executed from the applications main function. Any thoughts? Thanks, Stephan -- [ signature omitted ]
I've discovered the source of the problem described in my previous post below. My app runs on a headless server so I used QCoreApplication, however, the printing stuff wants QApplication. Once I ran the app with QApplication things worked fine on my desktop. On the server however, things were different. Here I got an error that it couldn't connect to the X Server now running with QApplication. Makes sense, there is no X server. It's a headless server, I don't need X! However, this raises the question, how does one print from a console app in QT? For now, I've solved the issue by directly connecting to the printer via a serial port which actually ultimately is the better thing to do as it gives me access to all the various ELP2 commands and advanced features that would otherwise not be accessible to me. However, still, I may have need to print using a regular printer from a headless server without X in the future. I don't see why X should be installed and running to print a document. Thanks, Stephan On Mon, 2008-04-07 at 17:35 -0400, Stephan Rose wrote: > I'm trying to set up a special server that using my own protocol > controls a locally attached printer. It's a special label printer and > this is to allow client applications anywhere in the building to print > out labels on this printer. This way the printer doesn't have to be > shared and no drivers, etc. need to be installed on local machines. > > Essentially this is halfway working. > > My server listens, gets the commands from my protocol and does what it's > supposed to do. I have one command that initializes the document, > followed by data commands, followed by an end command that signals to > print the label. > > During the initialization command, the QPrinter object is intialized and > the QPainter object is initialized. The end command simply just calls > end() on the QPainter and then does all other necessary cleanup. > > That part works. I get an empty label. > > The issue arises when I actually try to draw something on it. The > software crashes with the following error followed by a core dump: > > ïlp: Error - stdin is empty, so no job has been sent. > > And I just don't understand why. The code was copied from a small > utility that I've been using for months to print things with this > printer. The very same code works perfectly fine when executed from that > utility. > > The only difference I can see is that in the server version of the code > it is being executed from within a signal (readReady) in the QTcpSocket > instead of being executed from the applications main function. > > Any thoughts? > > Thanks, > > Stephan > > > -- > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body. > List archive and information: http://lists.trolltech.com/qt-interest/ > -- [ signature omitted ]
Stephan Rose wrote: >On the server however, things were different. Here I got an error that >it couldn't connect to the X Server now running with QApplication. Makes >sense, there is no X server. It's a headless server, I don't need X! Pass the QApplication::Tty parameter to the QApplication constructor. -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.