You are not logged in.

vratojr

Beginner

  • "vratojr" is male
  • "vratojr" started this thread

Posts: 2

Location: La Spezia,Italy

  • Send private message

1

Wednesday, January 11th 2006, 9:45am

Qt Printing on .ps

Hello,I have some problems with Qt when I try to pring on a .ps file. I tryed two approachs but I had some little problems with both of them.

The first:
-I created a QPrinter and a QPainter on IT.
-I draw something on the printer and then I call end() on the painter.
-I call once more begin() on the painter to continue drawing and the problem is that the QPrinter starts drawing in another page... How can I avoid this?

The second:
To avoid the problem told before I:
-Created a QPainter on a QPixmap.
-Drawn my things on the pixmap.
-Created a QPainter on the QPrinter and drawn directly the QPixmap.
The problem with this method is that the quality of the resulting .ps file is worst (very) of the first method.

With both methods I used the same configuration for my QPrinter:
QPrinter *PSPrinter = new QPrinter(QPrinter::ScreenResolution);
PSPrinter->setOrientation(QPrinter::Landscape);
PSPrinter->setPageSize(QPrinter::A5);
PSPrinter->setFullPage(TRUE);
PSPrinter->setOutputFileName(saveFileName);

Suggestions?

Thanks!

2

Thursday, May 13th 2010, 11:37am

If you want to create only single ps file with QPrinter and Qpainter then use only one begin() and end(). Your code should be like below

begin();
draw data(); // whatever you are drawing
newpage();

draw data(); // whatever you are drawing

newpage();

draw data(); // whatever you are drawing
end();

Hope it will help you.

This post has been edited 1 times, last edit by "saurabh_bhu80" (May 13th 2010, 11:45am)