Results 1 to 5 of 5

Thread: QPainter & QPrinter on linux (fedora 7)

  1. #1
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Question QPainter & QPrinter on linux (fedora 7)

    Hello.
    Painting on printer landscape orientation seems to behave oddly on linux (fedora 7).

    The following is my code snippet:

    QPrinter printer;
    printer.setOrientation ( QPrinter::Landscape );
    printer.setPageSize ( QPrinter::Legal );
    printer.setFullPage(true);

    QPainter paintPrinter;
    paintPrinter.begin ( &printer );
    paintPrinter.drawText ( 0, 0, 100, 25, Qt::AlignLeft, "Hello World" );
    paintPrinter.end();

    The program prints properly on windows.

    However on linux (fedora 7), it does not print anything at all - just ejects paper. If I use longer text sometimes it prints (correct orientation) BUT in the middle of the paper - horizontally and vertically (the margins seems to be incorrect).

    Any help?

    Thank you.

    Wilbert

  2. #2
    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: QPainter & QPrinter on linux (fedora 7)

    Does printing to PDF work properly?

  3. The following user says thank you to wysota for this useful post:

    wbt_ph (20th October 2007)

  4. #3
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPainter & QPrinter on linux (fedora 7)

    Wysota,

    Yes. Printing to PDF works properly.

    Unfortunately, after removing setOutputFileName, printing to printer in landscape orientation still prints in the middle of the page (wrong left margin) and clips the top part (possibly 3 lines) of the text I was trying to print.

    Wilbert.

  5. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter & QPrinter on linux (fedora 7)

    Look at the cups settings. Maybe you can find something there. What if you change the orientation from there for your printer?

  6. The following user says thank you to marcel for this useful post:

    wbt_ph (20th October 2007)

  7. #5
    Join Date
    Sep 2006
    Posts
    9
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPainter & QPrinter on linux (fedora 7)

    Marcel,

    Cups setting - no luck (I don't really know what to look for). I tried setting the printer (itself) to landscape orientation - gave the same erroneous positioned print out.

    It would seem to be a cups problem.

    After I setPrintProgram to lpr, I got a correct (more or less) positioned print out.

    Thank you for your help.

    Wilbert

Similar Threads

  1. Installing both qt3 and qt4 on linux ( Fedora Core )
    By vermarajeev in forum Installation and Deployment
    Replies: 3
    Last Post: 10th May 2007, 17:21
  2. QPainter & QPrinter
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2006, 14:19

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.