Results 1 to 9 of 9

Thread: Printing in Qt window with dotted lines produce huge PDF file and slow

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Printing in Qt window with dotted lines produce huge PDF file and slow

    Hi,

    I have grid lines with dotted line style, when print it into PDF in Windows, it creates huge PDF file (~100MB) and take ages to finish.

    Printing solid line style is reasonable fast and file is less than 200k.

    In linux, all are good.

    Any one has any suggestions what may be wrong?

    Thanks!

  2. #2
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    Anyone please?

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

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    Do you use the exact same settings for printing on Windows and Linux? Looks like on Windows your code rasterizes every dot in a line.
    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.


  4. #4
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    Yes, all codes are identical. Just recompile them.

    I use Adobe Acrobat when printing to PDF on Windows.

    I saw someone asking the same question at

    http://stackoverflow.com/questions/1...d-to-big-files

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    Quote Originally Posted by lni View Post
    I use Adobe Acrobat when printing to PDF on Windows.
    Can you be a bit more specific who Adobe Acrobat is involved here?
    Do you print using a PDF Pseudo printer provided by Adobe Acrobat?

    Cheers,
    _

  6. #6
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    Quote Originally Posted by anda_skoa View Post
    Can you be a bit more specific who Adobe Acrobat is involved here?
    Do you print using a PDF Pseudo printer provided by Adobe Acrobat?

    Cheers,
    _
    Yes, I use PDF Pseudo printer provided by Adobe Acrobat.

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

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    Quote Originally Posted by lni View Post
    Yes, I use PDF Pseudo printer provided by Adobe Acrobat.
    So shouldn't you be asking this question on Adobe forums?

    Why don't you use PDF printing facilities built into Qt?
    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.


  8. #8
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    Quote Originally Posted by wysota View Post
    So shouldn't you be asking this question on Adobe forums?

    Why don't you use PDF printing facilities built into Qt?
    I am using the one built by Qt.

    When click "Print", It pops up a dialog to select a printer, and I can select a real printer, or "Adobe PDF" virtual printer. Then QGraphicsScene::render is called to print the content.

    Do I use it wrong?

    Thanks

  9. #9
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Printing in Qt window with dotted lines produce huge PDF file and slow

    You are asking Qt to send the output to a printer. Qt does not care that is is not a physical printer or what that printer does with it. If Adobe's Distller chooses to make a high resolution raster image of a page that has nothing to do with Qt.

    If you ask Qt to render directly to a PDF, with QPrinter::setOutputFormat() and QPrinter::setOutputFileName(), then you are likely to get a different result because Qt has some control. Try this experiment:
    Qt Code:
    1. #include <QApplication>
    2. #include <QPainter>
    3. #include <QPrinter>
    4. #include <QPen>
    5.  
    6. int main(int argc, char **argv)
    7. {
    8. QApplication app(argc, argv);
    9. QPrinter printer(QPrinter::HighResolution);
    10. printer.setPaperSize(QPrinter::A4);
    11. printer.setOutputFormat(QPrinter::PdfFormat);
    12. printer.setOutputFileName("test.pdf");
    13. QPainter p(&printer);
    14. QRect rect = printer.pageRect();
    15. rect.moveTo(0, 0);
    16. p.setPen(QPen(Qt::DashLine));
    17. p.drawRect(rect);
    18. for (int i = 0; i < rect.height(); i += rect.height() / 50) {
    19. p.drawLine(QPoint(0, i), QPoint(rect.width(), i));
    20. }
    21. p.end();
    22.  
    23. return 0;
    24. }
    To copy to clipboard, switch view to plain text mode 

  10. The following user says thank you to ChrisW67 for this useful post:

    lni (17th February 2014)

Similar Threads

  1. Parse huge XML file
    By juracist in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2012, 01:54
  2. How to produce a single Executable exe file??
    By Gokulnathvc in forum Newbie
    Replies: 1
    Last Post: 4th August 2011, 07:32
  3. Understanding why these few lines are slow
    By hakermania in forum Qt Programming
    Replies: 18
    Last Post: 8th February 2011, 20:16
  4. How to hide dotted lines around the focused control?
    By gimel in forum Qt Programming
    Replies: 3
    Last Post: 6th November 2008, 07:09
  5. Huge Text File
    By mcosta in forum Qt Programming
    Replies: 3
    Last Post: 11th January 2008, 19:23

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.