Results 1 to 5 of 5

Thread: Qt4 poor printing performance

  1. #1
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt4 poor printing performance

    In my report designer I am printing about 200 items by QGraphicsScene::render to the QPainter associated to a QPrinter, and the output creates 2 pages. The painting/rendering performance is poor and very dependant of the printer type and the resolution selected in the printer settings. Previewing the same data on the screen renders in estimated 0.1 seconds just to have an idea.

    For example when printing to a OfficeJet G85 color inkjet at normal print quality, the rendering takes about 2 or 3 seconds. When printing to a Brother 2035 laser at normal quality with 300 DPI, the rendering takes about 20 seconds, alas even about 10 times what the inkjet needs for comparable quality. Selecting high quality 600DPI on the laser will make the rendering process use more that one minute, which is inacceptable for production use, don't even think about real lists with hundrets of pages that way.

    (Crystal reports to compare would render such data in subseconds on the same printers in high resolution!)

    Both printers are attached to another PC in the LAN by USB, and made available as network share. During the rendering time CPU usage is quite low, hardly above the idle load. There is also no noticeable disk activity during this time.

    Has anybody also seen such drastic printer dependent performance issues on different print devices?

    What could be done to improve performance, should I first render everything on a pixmap and then send the page as pixmap to the printer, would that make a difference?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt4 poor printing performance

    Just an idea: can you print to a file instead to the printer and examine that data that the printer should print?
    (It could be, for example, that CR sends postscript commands and Qt an pixel-based image. In that case the data volume to transmitted for Qt would be bigger.)
    Maybe you will gain other insights that way.
    Let us know if you could find something out that way.

    HTH

  3. #3
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt4 poor printing performance

    The file created for brother it total 30 kilobytes, whereas most is an embedded picture and the rest is some brother specific printer language:

    Qt Code:
    1. <esc>%-12345X@PJL
    2. @PJL SET REPRINT=JOB
    3. @PJL SET HOLD=OFF
    4. @PJL JOB NAME="Report List"
    5. @PJL PRINTLOG ITEM = 1,PRINTER
    6. @PJL PRINTLOG ITEM = 2,Wed,21 Jan 2009 12:35:41
    7. @PJL PRINTLOG ITEM = 3,kochp
    8. @PJL PRINTLOG ITEM = 4,SPEEDY
    9. @PJL SET ECONOMODE=OFF
    10. @PJL SET MEDIATYPE=REGULAR
    11. @PJL SET LANG=GERMAN
    12. @PJL SET RESOLUTION=300
    13. @PJL ENTER LANGUAGE=PCL
    14. <some embedded binary data here>
    15. %-12345X@PJL EOJ NAME="Report List"
    16. <esc>%-12345X
    17. <eof>
    To copy to clipboard, switch view to plain text mode 

    Rendering takes about half time as when really printing, still about 10 seconds. Wonder what Qt is doing or waiting for all that time. I'll try to track it down with the debugger.

  4. #4
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt4 poor printing performance

    I was able to make a workaround now which will reduce printing time to a fair amount. For example directly printing the document will use 75 seconds (!) at 600DPI on the brother.

    Instead I workaround now as:

    1. Get share name of the printer.
    2. If no share name found (local printer), print normal.
    3. For shared printer, print to file. Then copy the file to the printer share name.


    This way the printing lasts about 6 seconds for the network printer.

    Ugly workaround, but at least a temporary solution until Qt gets a better printer interface.

  5. #5
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt4 poor printing performance

    Wow.

    Today I thought I give postscript a try to further improve things, e.g. create a postscript file by QPrinter and the send that file to the printer via ghostscript. Well that was the plan at least. The idea was that postscript seemed to be the "native" printer output for Qt, and thus rendering a QGraphicsScene should be very fast because it could draw everything with postscript pimitives, right?

    Wrong. Completely wrong.

    The printing lasts even much longer than with the windows printing engine, and postscript file Qt creates is whopping 295 Megabytes. Yes, right read fellow, 295 Megabyte for two pages of A4.

    I don't get it that Qt has such a broken printing system when it comes to graphics.

    The only good news I have is that theoretically it would be possible to print performant with Qt, if the painting engines would get reworked. The PDF printer engine demonstrates this by printing that very graphics scenes in no time and making only a 40 Kilobyte file out of it.

    (Unfortunately the pdf engine is not yet complete, it does not print simple lines at all, and also not rectangles with certain linewidths.)

    My conclusion is that the whole printing stuff is stuck somewhere between alpha and beta when it comes to the graphics framework of Qt4.

Similar Threads

  1. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  2. Tabbed widget performance suggestions
    By MrGarbage in forum Qt Programming
    Replies: 0
    Last Post: 8th December 2007, 16:02
  3. [QT 4] QTextEdit performance
    By fellobo in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2006, 19:27
  4. Increasing performance from Qtextedit, listview, etc?
    By taylor34 in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 10:20

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.