0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-01-11 17:18:10 +03:00

Attempt to ignore printer rectangle if page size is equal to printer page size

This commit is contained in:
Arin Alexander 2019-01-25 01:47:34 +03:00
parent 2500a32023
commit 8486d8dd94

View File

@ -323,14 +323,14 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer)
renderPage.pageItem()->rightMargin(),
renderPage.pageItem()->bottomMargin(),
QPrinter::Millimeter);
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
printer.setOrientation(static_cast<QPrinter::Orientation>(renderPage.pageItem()->pageOrientation()));
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
renderPage.pageItem()->sizeMM();
printer.setPaperSize(pageSize,QPrinter::Millimeter);
} else {
printer.setFullPage(renderPage.pageItem()->fullPage());
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
printer.setOrientation(static_cast<QPrinter::Orientation>(renderPage.pageItem()->pageOrientation()));
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
@ -339,7 +339,7 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer)
printer.setPaperSize(pageSize,QPrinter::Millimeter);
} else {
if (page->getSetPageSizeToPrinter() || printer.outputFormat() == QPrinter::PdfFormat)
printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
printer.setPaperSize(static_cast<QPrinter::PageSize>(renderPage.pageItem()->pageSize()));
}
}
@ -354,7 +354,9 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer)
printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * Const::mmFACTOR,
(printerPageRect.size().height() + bottomMargin +topMargin) * Const::mmFACTOR);
if (printerPageRect.width() < page->geometry().width()){
if (printer.pageSize() != static_cast<QPrinter::PageSize>(page->pageSize()) &&
printerPageRect.width() < page->geometry().width())
{
qreal pageWidth = page->geometry().width();
QRectF currentPrintingRect = printerPageRect;
while (pageWidth>0){