Commit 3a48dd18 authored by Martin Koller's avatar Martin Koller
Browse files

Fix centered printout in landscape mode

BUG: 362359
parent 82835e0f
......@@ -1346,29 +1346,21 @@ void kpMainWindow::sendImageToPrinter (QPrinter *printer,
}
// Send image to printer.
QPainter painter;
painter.begin(printer);
double originX = 0, originY = 0;
// Center image on page?
if (d->configPrintImageCenteredOnPage)
{
originX =
(printerWidthMM * dpiX / KP_MILLIMETERS_PER_INCH - image.width ())
/ 2;
originY =
(printerHeightMM * dpiY / KP_MILLIMETERS_PER_INCH - image.height ())
/ 2;
originX = (printer->width() - image.width ()) / 2;
originY = (printer->height() - image.height ()) / 2;
}
#if DEBUG_KP_MAIN_WINDOW
kDebug () << "\torigin: x=" << originX << " y=" << originY;
#endif
// Send image to printer.
QPainter painter;
painter.begin (printer);
painter.drawImage (qRound (originX), qRound (originY), image);
painter.end ();
painter.drawImage(qRound(originX), qRound(originY), image);
painter.end();
}
//---------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment