diff --git a/src/core/layout/qgslayoutexporter.cpp b/src/core/layout/qgslayoutexporter.cpp index abd15200b552..1ab7190f3358 100644 --- a/src/core/layout/qgslayoutexporter.cpp +++ b/src/core/layout/qgslayoutexporter.cpp @@ -552,6 +552,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f ( void )contextRestorer; mLayout->renderContext().setDpi( settings.dpi ); mLayout->renderContext().setPredefinedScales( settings.predefinedMapScales ); + mLayout->renderContext().setMaskSettings( createExportMaskSettings() ); if ( settings.simplifyGeometries ) { @@ -777,6 +778,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( QgsAbstractLayou iterator->layout()->renderContext().setFlags( settings.flags ); iterator->layout()->renderContext().setPredefinedScales( settings.predefinedMapScales ); + iterator->layout()->renderContext().setMaskSettings( createExportMaskSettings() ); if ( settings.simplifyGeometries ) { @@ -1026,6 +1028,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToSvg( const QString &f mLayout->renderContext().setFlag( QgsLayoutRenderContext::FlagForceVectorOutput, settings.forceVectorOutput ); mLayout->renderContext().setTextRenderFormat( s.textRenderFormat ); mLayout->renderContext().setPredefinedScales( settings.predefinedMapScales ); + mLayout->renderContext().setMaskSettings( createExportMaskSettings() ); if ( settings.simplifyGeometries ) { @@ -1911,6 +1914,15 @@ QgsVectorSimplifyMethod QgsLayoutExporter::createExportSimplifyMethod() return simplifyMethod; } +QgsMaskRenderSettings QgsLayoutExporter::createExportMaskSettings() +{ + QgsMaskRenderSettings settings; + // this is quite a conservative setting -- I think we could make this more aggressive and get smaller file sizes + // without too much loss of quality... + settings.setSimplificationTolerance( 0.5 ); + return settings; +} + void QgsLayoutExporter::computeWorldFileParameters( double &a, double &b, double &c, double &d, double &e, double &f, double dpi ) const { if ( !mLayout ) diff --git a/src/core/layout/qgslayoutexporter.h b/src/core/layout/qgslayoutexporter.h index 3c92ead162ed..51005785e4b0 100644 --- a/src/core/layout/qgslayoutexporter.h +++ b/src/core/layout/qgslayoutexporter.h @@ -779,6 +779,7 @@ class CORE_EXPORT QgsLayoutExporter ExportResult handleLayeredExport( const QList &items, const std::function &exportFunc ); static QgsVectorSimplifyMethod createExportSimplifyMethod(); + static QgsMaskRenderSettings createExportMaskSettings(); friend class TestQgsLayout; friend class TestQgsLayoutExporter;