Results 1 to 4 of 4

Thread: Dot Matrix Printer

  1. #1
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Dot Matrix Printer

    Hi guys,

    I'm trying to print to a dot matrix printer, but when printing, the printer advances a few pages to print. The following code:

    Qt Code:
    1. QPrinter *prt = new QPrinter;
    2. prt->setPrinterName(ui.comboBox_Printers->currentText());
    3. qDebug() << "Printer: " << prt->printerName(); // Ok, dot printer
    4.  
    5. prt->setPaperSize(QSizeF(191, 93), QPrinter::Millimeter);
    6. prt->setFullPage(true);
    7.  
    8. QPainter painter(prt);
    9. painter.drawText(10, 10, 200, 100, Qt::AlignLeft | Qt::AlignTop, QString("Test printer"));
    To copy to clipboard, switch view to plain text mode 

    What may be happening?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Dot Matrix Printer

    Quote Originally Posted by estanisgeyer View Post
    What may be happening?
    You print outside your page boundaries.

  3. #3
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Re: Dot Matrix Printer

    Hi,

    There seems to be the problem. Moved to setFullPage(false) and the configuration of the cups, I changed the page size to custom, did not help. I tried also to change A3 and are now advanced a few pages, compared with the previous test.

    I'm using an Epson LX-300, tried with the driver Epson Dot Matrix Foomatic/eps9high and Generic IBM-Compatible dot matrix printer.

  4. #4
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: Dot Matrix Printer

    Well, I have not found a solution using the cups. The solution was to send directly to the device.

    Qt Code:
    1. QFile pr("/dev/usblp0"); // Device need 0666 permission to work.
    2.  
    3. if (pr.open(QFile::WriteOnly))
    4. {
    5. QTextStream o(&pr);
    6. o << r;
    7. }
    To copy to clipboard, switch view to plain text mode 

    This is me looking like a bug.

Similar Threads

  1. Replies: 6
    Last Post: 22nd November 2016, 13:57
  2. RichText printing with HighResolution printer
    By ghorwin in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2009, 10:04
  3. serial port printer sending commands, how?
    By triperzonak in forum Qt Programming
    Replies: 3
    Last Post: 6th April 2009, 14:51
  4. setting printer using Qt
    By rishiraj in forum Newbie
    Replies: 3
    Last Post: 2nd January 2009, 11:00
  5. making the printer correctly interpret pcl files
    By momesana in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2008, 16:41

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.