Results 1 to 4 of 4

Thread: serial port printer sending commands, how?

  1. #1
    Join Date
    Dec 2007
    Posts
    129
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default serial port printer sending commands, how?

    hi guys,

    i have a serial port printer and i want to print on it. Im using QPrinter and QTextDocument.print to print (it prints) but however the printer have some necessary commands for example autocut that need to be inputed e.g("\x1D\x56\x01"). What class should i use to send the command? and also until now im printing the file as a whole, how can i print it line by line so that i can change the font size of some line or bold some words.

    thanks in advance..

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: serial port printer sending commands, how?

    If you use QTextDocument then you should perform all the changes in the document and not while printing.

    If you want to print line by line, you have to open the serial port and act as the printer driver sending raw commands through the serial.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2007
    Posts
    129
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: serial port printer sending commands, how?

    how can i open the port? what class should i use and how do i send commands on it?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: serial port printer sending commands, how?

    Either use QExtSerialPort which you can download from web or use native API. With so fine grained control requirement that might be the best option.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. serial port same local machine
    By adamatic in forum Qt Programming
    Replies: 7
    Last Post: 3rd February 2009, 08:29
  2. accessing serial port without CONFIG += console
    By bnilsson in forum Qt Programming
    Replies: 2
    Last Post: 21st July 2008, 22:47
  3. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 10:23
  4. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 06:23
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.