mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Use millimeters when declaring QPrinter page size
(This is needed to allow to set a resolution with the printer used by the map renderer)
This commit is contained in:
parent
f8f7d60cf0
commit
a4b7af7fad
@ -5883,8 +5883,10 @@ void QgisApp::saveMapAsPdf()
|
||||
printer->setOutputFileName( fileName );
|
||||
printer->setOutputFormat( QPrinter::PdfFormat );
|
||||
printer->setOrientation( QPrinter::Portrait );
|
||||
printer->setPaperSize( dlg.size(), QPrinter::DevicePixel );
|
||||
printer->setPageMargins( 0, 0, 0, 0, QPrinter::DevicePixel );
|
||||
// paper size needs to be given in millimeters in order to be able to set a resolution to pass onto the map renderer
|
||||
printer->setPaperSize( dlg.size() * 25.4 / dlg.dpi(), QPrinter::Millimeter );
|
||||
printer->setPageMargins( 0, 0, 0, 0, QPrinter::Millimeter );
|
||||
printer->setResolution( dlg.dpi() );
|
||||
|
||||
QPainter *p = new QPainter();
|
||||
QImage *image = nullptr;
|
||||
@ -5907,7 +5909,6 @@ void QgisApp::saveMapAsPdf()
|
||||
}
|
||||
else
|
||||
{
|
||||
printer->setResolution( dlg.dpi() );
|
||||
p->begin( printer );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user