From 872a2219e0e7b45e17252d99f1149b09a15fe276 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 29 Aug 2019 22:17:34 +0300 Subject: [PATCH] Custom size printing has been changed --- limereport/lrpageitemdesignintf.cpp | 4 ++-- limereport/lrreportengine.cpp | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 47715c8..9d41a71 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -681,8 +681,8 @@ QSizeF PageItemDesignIntf::getRectByPageSize(const PageSize& size) printer.setOutputFormat(QPrinter::PdfFormat); printer.setOrientation((QPrinter::Orientation)pageOrientation()); printer.setPaperSize((QPrinter::PageSize)size); - return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * 10, - printer.paperSize(QPrinter::Millimeter).height() * 10); + return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * LimeReport::Const::mmFACTOR, + printer.paperSize(QPrinter::Millimeter).height() * LimeReport::Const::mmFACTOR); } else { diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 8a624e2..91db8b8 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -1812,7 +1812,6 @@ bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page) renderPage.render(m_painter, m_printer->pageRect(), currentPrintingRect); currentPrintingRect.adjust(printerPageRect.size().width(), 0, printerPageRect.size().width(), 0); curWidth += printerPageRect.size().width(); - } pageHeight -= printerPageRect.size().height(); curHeight += printerPageRect.size().height(); @@ -1822,7 +1821,10 @@ bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page) } } else { - renderPage.render(m_painter); + QRectF source = page->geometry(); + QSizeF inchSize = source.size() / (100 * 2.54); + QRectF target = QRectF(QPoint(0,0), inchSize * m_printer->resolution()); + renderPage.render(m_painter, target, source); } page->setPos(backupPagePos); return true; @@ -1843,6 +1845,7 @@ void PrintProcessor::initPrinter(PageItemDesignIntf* page) m_printer->setPaperSize(pageSize,QPrinter::Millimeter); } else { m_printer->setFullPage(page->fullPage()); + m_printer->setPageMargins(0,0,0,0, QPrinter::Millimeter); m_printer->setOrientation(static_cast(page->pageOrientation())); if (page->pageSize()==PageItemDesignIntf::Custom){ QSizeF pageSize = (page->pageOrientation()==PageItemDesignIntf::Landscape)?