QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
qgsalgorithmlayoutatlastopdf.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmlayoutatlastopdf.cpp
3 ---------------------
4 begin : August 2020
5 copyright : (C) 2020 by Mathieu Pellerin
6 email : nirvn dot asia at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
19
20#include "qgslayout.h"
21#include "qgslayoutatlas.h"
22#include "qgslayoutexporter.h"
23#include "qgslayoutitemmap.h"
24#include "qgslayoututils.h"
25#include "qgsprintlayout.h"
27
28#include <QString>
29
30using namespace Qt::StringLiterals;
31
33
34// QgsLayoutAtlasToPdfAlgorithmBase
35
36QStringList QgsLayoutAtlasToPdfAlgorithmBase::tags() const
37{
38 return QObject::tr( "layout,atlas,composer,composition,save" ).split( ',' );
39}
40
41QString QgsLayoutAtlasToPdfAlgorithmBase::group() const
42{
43 return QObject::tr( "Cartography" );
44}
45
46QString QgsLayoutAtlasToPdfAlgorithmBase::groupId() const
47{
48 return u"cartography"_s;
49}
50
51Qgis::ProcessingAlgorithmFlags QgsLayoutAtlasToPdfAlgorithmBase::flags() const
52{
54}
55
56void QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm( const QVariantMap & )
57{
58 addParameter( new QgsProcessingParameterLayout( u"LAYOUT"_s, QObject::tr( "Atlas layout" ) ) );
59
60 addParameter( new QgsProcessingParameterVectorLayer( u"COVERAGE_LAYER"_s, QObject::tr( "Coverage layer" ), QList<int>(), QVariant(), true ) );
61 addParameter( new QgsProcessingParameterExpression( u"FILTER_EXPRESSION"_s, QObject::tr( "Filter expression" ), QString(), u"COVERAGE_LAYER"_s, true ) );
62 addParameter( new QgsProcessingParameterExpression( u"SORTBY_EXPRESSION"_s, QObject::tr( "Sort expression" ), QString(), u"COVERAGE_LAYER"_s, true ) );
63 addParameter( new QgsProcessingParameterBoolean( u"SORTBY_REVERSE"_s, QObject::tr( "Reverse sort order (used when a sort expression is provided)" ), false ) );
64
65 auto layersParam
66 = std::make_unique<QgsProcessingParameterMultipleLayers>( u"LAYERS"_s, QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true );
67 layersParam->setFlags( layersParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
68 addParameter( layersParam.release() );
69
70 auto dpiParam = std::make_unique<QgsProcessingParameterNumber>( u"DPI"_s, QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 );
71 dpiParam->setFlags( dpiParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
72 addParameter( dpiParam.release() );
73
74 auto forceVectorParam = std::make_unique<QgsProcessingParameterBoolean>( u"FORCE_VECTOR"_s, QObject::tr( "Always export as vectors" ), false );
75 forceVectorParam->setFlags( forceVectorParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
76 addParameter( forceVectorParam.release() );
77
78 auto forceRasterParam = std::make_unique<QgsProcessingParameterBoolean>( u"FORCE_RASTER"_s, QObject::tr( "Always export as raster" ), false );
79 forceRasterParam->setFlags( forceRasterParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
80 addParameter( forceRasterParam.release() );
81
82 auto appendGeorefParam = std::make_unique<QgsProcessingParameterBoolean>( u"GEOREFERENCE"_s, QObject::tr( "Append georeference information" ), true );
83 appendGeorefParam->setFlags( appendGeorefParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
84 addParameter( appendGeorefParam.release() );
85
86 auto exportRDFParam = std::make_unique<QgsProcessingParameterBoolean>( u"INCLUDE_METADATA"_s, QObject::tr( "Export RDF metadata (title, author, etc.)" ), true );
87 exportRDFParam->setFlags( exportRDFParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
88 addParameter( exportRDFParam.release() );
89
90 auto disableTiled = std::make_unique<QgsProcessingParameterBoolean>( u"DISABLE_TILED"_s, QObject::tr( "Disable tiled raster layer exports" ), false );
91 disableTiled->setFlags( disableTiled->flags() | Qgis::ProcessingParameterFlag::Advanced );
92 addParameter( disableTiled.release() );
93
94 auto simplify = std::make_unique<QgsProcessingParameterBoolean>( u"SIMPLIFY"_s, QObject::tr( "Simplify geometries to reduce output file size" ), true );
95 simplify->setFlags( simplify->flags() | Qgis::ProcessingParameterFlag::Advanced );
96 addParameter( simplify.release() );
97
98 const QStringList textExportOptions {
99 QObject::tr( "Always Export Text as Paths (Recommended)" ),
100 QObject::tr( "Always Export Text as Text Objects" ),
101 QObject::tr( "Prefer Exporting Text as Text Objects" ),
102 };
103
104 auto textFormat = std::make_unique<QgsProcessingParameterEnum>( u"TEXT_FORMAT"_s, QObject::tr( "Text export" ), textExportOptions, false, 0 );
105 textFormat->setFlags( textFormat->flags() | Qgis::ProcessingParameterFlag::Advanced );
106 addParameter( textFormat.release() );
107
108 const QStringList imageCompressionOptions { QObject::tr( "Lossy (JPEG)" ), QObject::tr( "Lossless" ) };
109
110 auto imageCompression = std::make_unique<QgsProcessingParameterEnum>( u"IMAGE_COMPRESSION"_s, QObject::tr( "Image compression" ), imageCompressionOptions, false, 0 );
111 imageCompression->setFlags( imageCompression->flags() | Qgis::ProcessingParameterFlag::Advanced );
112 addParameter( imageCompression.release() );
113}
114
115QVariantMap QgsLayoutAtlasToPdfAlgorithmBase::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
116{
117 // this needs to be done in main thread, layouts are not thread safe
118 QgsPrintLayout *l = parameterAsLayout( parameters, u"LAYOUT"_s, context );
119 if ( !l )
120 throw QgsProcessingException( QObject::tr( "Cannot find layout with name \"%1\"" ).arg( parameters.value( u"LAYOUT"_s ).toString() ) );
121
122 std::unique_ptr<QgsPrintLayout> layout( l->clone() );
123 QgsLayoutAtlas *atlas = layout->atlas();
124
125 QString expression, error;
126 QgsVectorLayer *layer = parameterAsVectorLayer( parameters, u"COVERAGE_LAYER"_s, context );
127 if ( layer )
128 {
129 atlas->setEnabled( true );
130 atlas->setCoverageLayer( layer );
131
132 expression = parameterAsString( parameters, u"FILTER_EXPRESSION"_s, context );
133 atlas->setFilterExpression( expression, error );
134 atlas->setFilterFeatures( !expression.isEmpty() && error.isEmpty() );
135 if ( !expression.isEmpty() && !error.isEmpty() )
136 {
137 throw QgsProcessingException( QObject::tr( "Error setting atlas filter expression" ) );
138 }
139 error.clear();
140
141 expression = parameterAsString( parameters, u"SORTBY_EXPRESSION"_s, context );
142 if ( !expression.isEmpty() )
143 {
144 const bool sortByReverse = parameterAsBool( parameters, u"SORTBY_REVERSE"_s, context );
145 atlas->setSortFeatures( true );
146 atlas->setSortExpression( expression );
147 atlas->setSortAscending( !sortByReverse );
148 }
149 else
150 {
151 atlas->setSortFeatures( false );
152 }
153 }
154 else if ( !atlas->enabled() )
155 {
156 throw QgsProcessingException( QObject::tr( "Selected layout does not have atlas functionality enabled" ) );
157 }
158
159 const QgsLayoutExporter exporter( layout.get() );
161
162 if ( parameters.value( u"DPI"_s ).isValid() )
163 {
164 settings.dpi = parameterAsDouble( parameters, u"DPI"_s, context );
165 }
166 settings.forceVectorOutput = parameterAsBool( parameters, u"FORCE_VECTOR"_s, context );
167 settings.rasterizeWholeImage = parameterAsBool( parameters, u"FORCE_RASTER"_s, context );
168 settings.appendGeoreference = parameterAsBool( parameters, u"GEOREFERENCE"_s, context );
169 settings.exportMetadata = parameterAsBool( parameters, u"INCLUDE_METADATA"_s, context );
170 settings.simplifyGeometries = parameterAsBool( parameters, u"SIMPLIFY"_s, context );
171 const int textFormat = parameterAsEnum( parameters, u"TEXT_FORMAT"_s, context );
172 switch ( textFormat )
173 {
174 case 0:
176 break;
177 case 1:
179 break;
180 case 2:
182 break;
183 default:
184 break;
185 }
186
187 if ( parameterAsBool( parameters, u"DISABLE_TILED"_s, context ) )
189 else
190 settings.flags = settings.flags & ~static_cast< int >( Qgis::LayoutRenderFlag::DisableTiledRasterLayerRenders );
191
192 if ( parameterAsEnum( parameters, u"IMAGE_COMPRESSION"_s, context ) == 1 )
194 else
195 settings.flags = settings.flags & ~static_cast< int >( Qgis::LayoutRenderFlag::LosslessImageRendering );
196
197 settings.predefinedMapScales = QgsLayoutUtils::predefinedScales( layout.get() );
198
199 const QList<QgsMapLayer *> layers = parameterAsLayerList( parameters, u"LAYERS"_s, context );
200 if ( layers.size() > 0 )
201 {
202 const QList<QGraphicsItem *> items = layout->items();
203 for ( QGraphicsItem *graphicsItem : items )
204 {
205 QgsLayoutItem *item = dynamic_cast<QgsLayoutItem *>( graphicsItem );
206 QgsLayoutItemMap *map = dynamic_cast<QgsLayoutItemMap *>( item );
207 if ( map && !map->followVisibilityPreset() && !map->keepLayerSet() )
208 {
209 map->setKeepLayerSet( true );
210 map->setLayers( layers );
211 }
212 }
213 }
214
215 return exportAtlas( atlas, exporter, settings, parameters, context, feedback );
216}
217
218//
219// QgsLayoutAtlasToPdfAlgorithm
220//
221
222QString QgsLayoutAtlasToPdfAlgorithm::name() const
223{
224 return u"atlaslayouttopdf"_s;
225}
226
227QString QgsLayoutAtlasToPdfAlgorithm::displayName() const
228{
229 return QObject::tr( "Export atlas layout as PDF (single file)" );
230}
231
232QString QgsLayoutAtlasToPdfAlgorithm::shortDescription() const
233{
234 return QObject::tr( "Exports an atlas layout as a single PDF file." );
235}
236
237QString QgsLayoutAtlasToPdfAlgorithm::shortHelpString() const
238{
239 return QObject::tr(
240 "This algorithm outputs an atlas layout as a single PDF file.\n\n"
241 "If a coverage layer is set, the selected layout's atlas settings exposed in this algorithm "
242 "will be overwritten. In this case, an empty filter or sort by expression will turn those "
243 "settings off."
244 );
245}
246
247void QgsLayoutAtlasToPdfAlgorithm::initAlgorithm( const QVariantMap & )
248{
249 QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm();
250 addParameter( new QgsProcessingParameterFileDestination( u"OUTPUT"_s, QObject::tr( "PDF file" ), QObject::tr( "PDF Format" ) + " (*.pdf *.PDF)" ) );
251}
252
253QgsLayoutAtlasToPdfAlgorithm *QgsLayoutAtlasToPdfAlgorithm::createInstance() const
254{
255 return new QgsLayoutAtlasToPdfAlgorithm();
256}
257
258QVariantMap QgsLayoutAtlasToPdfAlgorithm::exportAtlas(
259 QgsLayoutAtlas *atlas, const QgsLayoutExporter &exporter, const QgsLayoutExporter::PdfExportSettings &settings, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback
260)
261{
262 Q_UNUSED( exporter )
263
264 const QString dest = parameterAsFileOutput( parameters, u"OUTPUT"_s, context );
265
266 QString error;
267 if ( atlas->updateFeatures() )
268 {
269 feedback->pushInfo( QObject::tr( "Exporting %n atlas feature(s)", "", atlas->count() ) );
270 switch ( QgsLayoutExporter::exportToPdf( atlas, dest, settings, error, feedback ) )
271 {
273 {
274 feedback->pushInfo( QObject::tr( "Successfully exported atlas to %1" ).arg( QDir::toNativeSeparators( dest ) ) );
275 break;
276 }
277
279 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Cannot write to %1.\n\nThis file may be open in another application." ).arg( QDir::toNativeSeparators( dest ) ) );
280
282 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Could not create print device." ) );
283
286 !error.isEmpty() ? error
287 : QObject::tr(
288 "Trying to create the image "
289 "resulted in a memory overflow.\n\n"
290 "Please try a lower resolution or a smaller paper size."
291 )
292 );
293
295 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Error encountered while exporting atlas." ) );
296
299 // no meaning for PDF exports, will not be encountered
300 break;
301 }
302 }
303 else
304 {
305 feedback->reportError( QObject::tr( "No atlas features found" ) );
306 }
307
308 feedback->setProgress( 100 );
309
310 QVariantMap outputs;
311 outputs.insert( u"OUTPUT"_s, dest );
312 return outputs;
313}
314
315//
316// QgsLayoutAtlasToMultiplePdfAlgorithm
317//
318
319QString QgsLayoutAtlasToMultiplePdfAlgorithm::name() const
320{
321 return u"atlaslayouttomultiplepdf"_s;
322}
323
324QString QgsLayoutAtlasToMultiplePdfAlgorithm::displayName() const
325{
326 return QObject::tr( "Export atlas layout as PDF (multiple files)" );
327}
328
329QString QgsLayoutAtlasToMultiplePdfAlgorithm::shortDescription() const
330{
331 return QObject::tr( "Exports an atlas layout to multiple PDF files." );
332}
333
334QString QgsLayoutAtlasToMultiplePdfAlgorithm::shortHelpString() const
335{
336 return QObject::tr(
337 "This algorithm outputs an atlas layout to multiple PDF files.\n\n"
338 "If a coverage layer is set, the selected layout's atlas settings exposed in this algorithm "
339 "will be overwritten. In this case, an empty filter or sort by expression will turn those "
340 "settings off.\n"
341 );
342}
343
344void QgsLayoutAtlasToMultiplePdfAlgorithm::initAlgorithm( const QVariantMap & )
345{
346 QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm();
347 addParameter( new QgsProcessingParameterExpression( u"OUTPUT_FILENAME"_s, QObject::tr( "Output filename" ), QString(), u"COVERAGE_LAYER"_s, true ) );
348 addParameter( new QgsProcessingParameterFile( u"OUTPUT_FOLDER"_s, QObject::tr( "Output folder" ), Qgis::ProcessingFileParameterBehavior::Folder ) );
349}
350
351QgsLayoutAtlasToMultiplePdfAlgorithm *QgsLayoutAtlasToMultiplePdfAlgorithm::createInstance() const
352{
353 return new QgsLayoutAtlasToMultiplePdfAlgorithm();
354}
355
356QVariantMap QgsLayoutAtlasToMultiplePdfAlgorithm::exportAtlas(
357 QgsLayoutAtlas *atlas, const QgsLayoutExporter &exporter, const QgsLayoutExporter::PdfExportSettings &settings, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback
358)
359{
360 Q_UNUSED( exporter )
361
362 QString error;
363
364 const QString filename = parameterAsString( parameters, u"OUTPUT_FILENAME"_s, context );
365 const QString destFolder = parameterAsFile( parameters, u"OUTPUT_FOLDER"_s, context );
366
367 // the "atlas.pdf" part will be overridden, only the folder is important
368 const QString dest = u"%1/atlas.pdf"_s.arg( destFolder );
369
370 if ( atlas->updateFeatures() )
371 {
372 feedback->pushInfo( QObject::tr( "Exporting %n atlas feature(s)", "", atlas->count() ) );
373
375 if ( atlas->filenameExpression().isEmpty() && filename.isEmpty() )
376 {
377 atlas->setFilenameExpression( u"'output_'||@atlas_featurenumber"_s, error );
378 }
379 else if ( !filename.isEmpty() )
380 {
381 if ( !atlas->setFilenameExpression( filename, error ) )
382 {
383 throw QgsProcessingException( QObject::tr( "Output file name expression is not valid: %1" ).arg( error ) );
384 }
385 }
386
387 result = QgsLayoutExporter::exportToPdfs( atlas, dest, settings, error, feedback );
388
389 switch ( result )
390 {
392 {
393 feedback->pushInfo( QObject::tr( "Successfully exported atlas to %1" ).arg( QDir::toNativeSeparators( destFolder ) ) );
394 break;
395 }
396
398 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Cannot write to %1.\n\nThis file may be open in another application." ).arg( QDir::toNativeSeparators( dest ) ) );
399
401 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Could not create print device." ) );
402
405 !error.isEmpty() ? error
406 : QObject::tr(
407 "Trying to create the image "
408 "resulted in a memory overflow.\n\n"
409 "Please try a lower resolution or a smaller paper size."
410 )
411 );
412
414 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Error encountered while exporting atlas." ) );
415
418 // no meaning for PDF exports, will not be encountered
419 break;
420 }
421 }
422 else
423 {
424 feedback->reportError( QObject::tr( "No atlas features found" ) );
425 }
426
427 feedback->setProgress( 100 );
428
429 QVariantMap outputs;
430 outputs.insert( u"OUTPUT_FOLDER"_s, destFolder );
431 return outputs;
432}
433
@ MapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer).
Definition qgis.h:3646
@ Folder
Parameter is a folder.
Definition qgis.h:3907
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
Definition qgis.h:3724
@ PreferText
Render text as text objects, unless doing so results in rendering artifacts or poor quality rendering...
Definition qgis.h:2930
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
Definition qgis.h:2924
@ AlwaysText
Always render text as text objects. While this mode preserves text objects as text for post-processin...
Definition qgis.h:2927
@ NoThreading
Algorithm is not thread safe and cannot be run in a background thread, e.g. for algorithms which mani...
Definition qgis.h:3703
@ RequiresProject
The algorithm requires that a valid QgsProject is available from the processing context in order to e...
Definition qgis.h:3711
@ Advanced
Parameter is an advanced parameter which should be hidden from users by default.
Definition qgis.h:3880
@ Double
Double/float values.
Definition qgis.h:3921
@ DisableTiledRasterLayerRenders
If set, then raster layers will not be drawn as separate tiles. This may improve the appearance in ex...
Definition qgis.h:5403
@ LosslessImageRendering
Render images losslessly whenever possible, instead of the default lossy jpeg rendering used for some...
Definition qgis.h:5407
void setProgress(double progress)
Sets the current progress for the feedback object.
Definition qgsfeedback.h:65
Used to render QgsLayout as an atlas, by iterating over the features from an associated vector layer.
QString filenameExpression() const
Returns the filename expression used for generating output filenames for each atlas page.
void setCoverageLayer(QgsVectorLayer *layer)
Sets the coverage layer to use for the atlas features.
bool setFilterExpression(const QString &expression, QString &errorString)
Sets the expression used for filtering features in the coverage layer.
void setSortAscending(bool ascending)
Sets whether features should be sorted in an ascending order.
void setEnabled(bool enabled)
Sets whether the atlas is enabled.
bool enabled() const
Returns whether the atlas generation is enabled.
bool setFilenameExpression(const QString &expression, QString &errorString)
Sets the filename expression used for generating output filenames for each atlas page.
void setSortFeatures(bool enabled)
Sets whether features should be sorted in the atlas.
int count() const override
Returns the number of features to iterate over.
void setSortExpression(const QString &expression)
Sets the expression (or field name) to use for sorting features.
void setFilterFeatures(bool filtered)
Sets whether features should be filtered in the coverage layer.
int updateFeatures()
Requeries the current atlas coverage layer and applies filtering and sorting.
Handles rendering and exports of layouts to various formats.
ExportResult exportToPdf(const QString &filePath, const QgsLayoutExporter::PdfExportSettings &settings)
Exports the layout as a PDF to the filePath, using the specified export settings.
ExportResult
Result codes for exporting layouts.
@ Canceled
Export was canceled.
@ MemoryError
Unable to allocate memory required to export.
@ PrintError
Could not start printing to destination device.
@ IteratorError
Error iterating over layout.
@ FileError
Could not write to destination file, likely due to a lock held by another application.
@ Success
Export was successful.
@ SvgLayerError
Could not create layered SVG file.
static ExportResult exportToPdfs(QgsAbstractLayoutIterator *iterator, const QString &baseFilePath, const QgsLayoutExporter::PdfExportSettings &settings, QString &error, QgsFeedback *feedback=nullptr)
Exports a layout iterator to multiple PDF files, with the specified export settings.
Layout graphical items for displaying a map.
bool keepLayerSet() const
Returns whether a stored layer set should be used or the current layer set from the project associate...
void setKeepLayerSet(bool enabled)
Sets whether the stored layer set should be used or the current layer set of the associated project.
bool followVisibilityPreset() const
Returns whether the map should follow a map theme.
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the stored layers set.
Base class for graphical items within a QgsLayout.
static QVector< double > predefinedScales(const QgsLayout *layout)
Returns a list of predefined scales associated with a layout.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
QgsPrintLayout * clone() const override
Creates a clone of the layout.
virtual Qgis::ProcessingAlgorithmFlags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
A boolean parameter for processing algorithms.
An expression parameter for processing algorithms.
A generic file based destination parameter, for specifying the destination path for a file (non-map l...
An input file or folder parameter for processing algorithms.
A print layout parameter, allowing users to select a print layout.
A vector layer (with or without geometry) parameter for processing algorithms.
Represents a vector layer which manages a vector based dataset.
Contains settings relating to exporting layouts to PDF.
bool forceVectorOutput
Set to true to force vector object exports, even when the resultant appearance will differ from the l...
bool rasterizeWholeImage
Set to true to force whole layout to be rasterized while exporting.
bool exportMetadata
Indicates whether PDF export should include metadata generated from the layout's project's metadata.
bool appendGeoreference
Indicates whether PDF export should append georeference data.
Qgis::LayoutRenderFlags flags
Layout context flags, which control how the export will be created.
double dpi
Resolution to export layout at. If dpi <= 0 the default layout dpi will be used.
QVector< qreal > predefinedMapScales
A list of predefined scales to use with the layout.
bool simplifyGeometries
Indicates whether vector geometries should be simplified to avoid redundant extraneous detail,...
Qgis::TextRenderFormat textRenderFormat
Text rendering format, which controls how text should be rendered in the export (e....