PDA

View Full Version : QPainter & QPrinter on linux (fedora 7)



wbt_ph
20th October 2007, 08:21
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

wysota
20th October 2007, 09:02
Does printing to PDF work properly?

wbt_ph
20th October 2007, 11:53
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.

marcel
20th October 2007, 11:55
Look at the cups settings. Maybe you can find something there. What if you change the orientation from there for your printer?

wbt_ph
20th October 2007, 15:37
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