QGIS API Documentation 3.41.0-Master (cea29feecf2)
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#include "qgslayout.h"
20#include "qgslayoutatlas.h"
21#include "qgslayoutitemmap.h"
22#include "qgslayoututils.h"
23#include "qgsprintlayout.h"
25#include "qgslayoutexporter.h"
26
28
29// QgsLayoutAtlasToPdfAlgorithmBase
30
31QStringList QgsLayoutAtlasToPdfAlgorithmBase::tags() const
32{
33 return QObject::tr( "layout,atlas,composer,composition,save" ).split( ',' );
34}
35
36QString QgsLayoutAtlasToPdfAlgorithmBase::group() const
37{
38 return QObject::tr( "Cartography" );
39}
40
41QString QgsLayoutAtlasToPdfAlgorithmBase::groupId() const
42{
43 return QStringLiteral( "cartography" );
44}
45
46Qgis::ProcessingAlgorithmFlags QgsLayoutAtlasToPdfAlgorithmBase::flags() const
47{
49}
50
51void QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm( const QVariantMap & )
52{
53 addParameter( new QgsProcessingParameterLayout( QStringLiteral( "LAYOUT" ), QObject::tr( "Atlas layout" ) ) );
54
55 addParameter( new QgsProcessingParameterVectorLayer( QStringLiteral( "COVERAGE_LAYER" ), QObject::tr( "Coverage layer" ), QList<int>(), QVariant(), true ) );
56 addParameter( new QgsProcessingParameterExpression( QStringLiteral( "FILTER_EXPRESSION" ), QObject::tr( "Filter expression" ), QString(), QStringLiteral( "COVERAGE_LAYER" ), true ) );
57 addParameter( new QgsProcessingParameterExpression( QStringLiteral( "SORTBY_EXPRESSION" ), QObject::tr( "Sort expression" ), QString(), QStringLiteral( "COVERAGE_LAYER" ), true ) );
58 addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "SORTBY_REVERSE" ), QObject::tr( "Reverse sort order (used when a sort expression is provided)" ), false ) );
59
60 std::unique_ptr<QgsProcessingParameterMultipleLayers> layersParam = std::make_unique<QgsProcessingParameterMultipleLayers>( QStringLiteral( "LAYERS" ), QObject::tr( "Map layers to assign to unlocked map item(s)" ), Qgis::ProcessingSourceType::MapLayer, QVariant(), true );
61 layersParam->setFlags( layersParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
62 addParameter( layersParam.release() );
63
64 std::unique_ptr<QgsProcessingParameterNumber> dpiParam = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "DPI" ), QObject::tr( "DPI (leave blank for default layout DPI)" ), Qgis::ProcessingNumberParameterType::Double, QVariant(), true, 0 );
65 dpiParam->setFlags( dpiParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
66 addParameter( dpiParam.release() );
67
68 std::unique_ptr<QgsProcessingParameterBoolean> forceVectorParam = std::make_unique<QgsProcessingParameterBoolean>( QStringLiteral( "FORCE_VECTOR" ), QObject::tr( "Always export as vectors" ), false );
69 forceVectorParam->setFlags( forceVectorParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
70 addParameter( forceVectorParam.release() );
71
72 std::unique_ptr<QgsProcessingParameterBoolean> forceRasterParam = std::make_unique<QgsProcessingParameterBoolean>( QStringLiteral( "FORCE_RASTER" ), QObject::tr( "Always export as raster" ), false );
73 forceRasterParam->setFlags( forceRasterParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
74 addParameter( forceRasterParam.release() );
75
76 std::unique_ptr<QgsProcessingParameterBoolean> appendGeorefParam = std::make_unique<QgsProcessingParameterBoolean>( QStringLiteral( "GEOREFERENCE" ), QObject::tr( "Append georeference information" ), true );
77 appendGeorefParam->setFlags( appendGeorefParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
78 addParameter( appendGeorefParam.release() );
79
80 std::unique_ptr<QgsProcessingParameterBoolean> exportRDFParam = std::make_unique<QgsProcessingParameterBoolean>( QStringLiteral( "INCLUDE_METADATA" ), QObject::tr( "Export RDF metadata (title, author, etc.)" ), true );
81 exportRDFParam->setFlags( exportRDFParam->flags() | Qgis::ProcessingParameterFlag::Advanced );
82 addParameter( exportRDFParam.release() );
83
84 std::unique_ptr<QgsProcessingParameterBoolean> disableTiled = std::make_unique<QgsProcessingParameterBoolean>( QStringLiteral( "DISABLE_TILED" ), QObject::tr( "Disable tiled raster layer exports" ), false );
85 disableTiled->setFlags( disableTiled->flags() | Qgis::ProcessingParameterFlag::Advanced );
86 addParameter( disableTiled.release() );
87
88 std::unique_ptr<QgsProcessingParameterBoolean> simplify = std::make_unique<QgsProcessingParameterBoolean>( QStringLiteral( "SIMPLIFY" ), QObject::tr( "Simplify geometries to reduce output file size" ), true );
89 simplify->setFlags( simplify->flags() | Qgis::ProcessingParameterFlag::Advanced );
90 addParameter( simplify.release() );
91
92 const QStringList textExportOptions {
93 QObject::tr( "Always Export Text as Paths (Recommended)" ),
94 QObject::tr( "Always Export Text as Text Objects" ),
95 QObject::tr( "Prefer Exporting Text as Text Objects" ),
96 };
97
98 std::unique_ptr<QgsProcessingParameterEnum> textFormat = std::make_unique<QgsProcessingParameterEnum>( QStringLiteral( "TEXT_FORMAT" ), QObject::tr( "Text export" ), textExportOptions, false, 0 );
99 textFormat->setFlags( textFormat->flags() | Qgis::ProcessingParameterFlag::Advanced );
100 addParameter( textFormat.release() );
101
102 const QStringList imageCompressionOptions {
103 QObject::tr( "Lossy (JPEG)" ),
104 QObject::tr( "Lossless" )
105 };
106
107 std::unique_ptr<QgsProcessingParameterEnum> imageCompression = std::make_unique<QgsProcessingParameterEnum>( QStringLiteral( "IMAGE_COMPRESSION" ), QObject::tr( "Image compression" ), imageCompressionOptions, false, 0 );
108 imageCompression->setFlags( imageCompression->flags() | Qgis::ProcessingParameterFlag::Advanced );
109 addParameter( imageCompression.release() );
110}
111
112QVariantMap QgsLayoutAtlasToPdfAlgorithmBase::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
113{
114 // this needs to be done in main thread, layouts are not thread safe
115 QgsPrintLayout *l = parameterAsLayout( parameters, QStringLiteral( "LAYOUT" ), context );
116 if ( !l )
117 throw QgsProcessingException( QObject::tr( "Cannot find layout with name \"%1\"" ).arg( parameters.value( QStringLiteral( "LAYOUT" ) ).toString() ) );
118
119 std::unique_ptr<QgsPrintLayout> layout( l->clone() );
120 QgsLayoutAtlas *atlas = layout->atlas();
121
122 QString expression, error;
123 QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral( "COVERAGE_LAYER" ), context );
124 if ( layer )
125 {
126 atlas->setEnabled( true );
127 atlas->setCoverageLayer( layer );
128
129 expression = parameterAsString( parameters, QStringLiteral( "FILTER_EXPRESSION" ), context );
130 atlas->setFilterExpression( expression, error );
131 atlas->setFilterFeatures( !expression.isEmpty() && error.isEmpty() );
132 if ( !expression.isEmpty() && !error.isEmpty() )
133 {
134 throw QgsProcessingException( QObject::tr( "Error setting atlas filter expression" ) );
135 }
136 error.clear();
137
138 expression = parameterAsString( parameters, QStringLiteral( "SORTBY_EXPRESSION" ), context );
139 if ( !expression.isEmpty() )
140 {
141 const bool sortByReverse = parameterAsBool( parameters, QStringLiteral( "SORTBY_REVERSE" ), context );
142 atlas->setSortFeatures( true );
143 atlas->setSortExpression( expression );
144 atlas->setSortAscending( !sortByReverse );
145 }
146 else
147 {
148 atlas->setSortFeatures( false );
149 }
150 }
151 else if ( !atlas->enabled() )
152 {
153 throw QgsProcessingException( QObject::tr( "Selected layout does not have atlas functionality enabled" ) );
154 }
155
156 const QgsLayoutExporter exporter( layout.get() );
158
159 if ( parameters.value( QStringLiteral( "DPI" ) ).isValid() )
160 {
161 settings.dpi = parameterAsDouble( parameters, QStringLiteral( "DPI" ), context );
162 }
163 settings.forceVectorOutput = parameterAsBool( parameters, QStringLiteral( "FORCE_VECTOR" ), context );
164 settings.rasterizeWholeImage = parameterAsBool( parameters, QStringLiteral( "FORCE_RASTER" ), context );
165 settings.appendGeoreference = parameterAsBool( parameters, QStringLiteral( "GEOREFERENCE" ), context );
166 settings.exportMetadata = parameterAsBool( parameters, QStringLiteral( "INCLUDE_METADATA" ), context );
167 settings.simplifyGeometries = parameterAsBool( parameters, QStringLiteral( "SIMPLIFY" ), context );
168 const int textFormat = parameterAsEnum( parameters, QStringLiteral( "TEXT_FORMAT" ), context );
169 switch ( textFormat )
170 {
171 case 0:
173 break;
174 case 1:
176 break;
177 case 2:
179 break;
180 default:
181 break;
182 }
183
184 if ( parameterAsBool( parameters, QStringLiteral( "DISABLE_TILED" ), context ) )
186 else
187 settings.flags = settings.flags & ~QgsLayoutRenderContext::FlagDisableTiledRasterLayerRenders;
188
189 if ( parameterAsEnum( parameters, QStringLiteral( "IMAGE_COMPRESSION" ), context ) == 1 )
191 else
192 settings.flags = settings.flags & ~QgsLayoutRenderContext::FlagLosslessImageRendering;
193
194 settings.predefinedMapScales = QgsLayoutUtils::predefinedScales( layout.get() );
195
196 const QList<QgsMapLayer *> layers = parameterAsLayerList( parameters, QStringLiteral( "LAYERS" ), context );
197 if ( layers.size() > 0 )
198 {
199 const QList<QGraphicsItem *> items = layout->items();
200 for ( QGraphicsItem *graphicsItem : items )
201 {
202 QgsLayoutItem *item = dynamic_cast<QgsLayoutItem *>( graphicsItem );
203 QgsLayoutItemMap *map = dynamic_cast<QgsLayoutItemMap *>( item );
204 if ( map && !map->followVisibilityPreset() && !map->keepLayerSet() )
205 {
206 map->setKeepLayerSet( true );
207 map->setLayers( layers );
208 }
209 }
210 }
211
212 return exportAtlas( atlas, exporter, settings, parameters, context, feedback );
213}
214
215//
216// QgsLayoutAtlasToPdfAlgorithm
217//
218
219QString QgsLayoutAtlasToPdfAlgorithm::name() const
220{
221 return QStringLiteral( "atlaslayouttopdf" );
222}
223
224QString QgsLayoutAtlasToPdfAlgorithm::displayName() const
225{
226 return QObject::tr( "Export atlas layout as PDF (single file)" );
227}
228
229QString QgsLayoutAtlasToPdfAlgorithm::shortDescription() const
230{
231 return QObject::tr( "Exports an atlas layout as a single PDF file." );
232}
233
234QString QgsLayoutAtlasToPdfAlgorithm::shortHelpString() const
235{
236 return QObject::tr( "This algorithm outputs an atlas layout as a single PDF file.\n\n"
237 "If a coverage layer is set, the selected layout's atlas settings exposed in this algorithm "
238 "will be overwritten. In this case, an empty filter or sort by expression will turn those "
239 "settings off." );
240}
241
242void QgsLayoutAtlasToPdfAlgorithm::initAlgorithm( const QVariantMap & )
243{
244 QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm();
245 addParameter( new QgsProcessingParameterFileDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "PDF file" ), QObject::tr( "PDF Format" ) + " (*.pdf *.PDF)" ) );
246}
247
248QgsLayoutAtlasToPdfAlgorithm *QgsLayoutAtlasToPdfAlgorithm::createInstance() const
249{
250 return new QgsLayoutAtlasToPdfAlgorithm();
251}
252
253QVariantMap QgsLayoutAtlasToPdfAlgorithm::exportAtlas( QgsLayoutAtlas *atlas, const QgsLayoutExporter &exporter, const QgsLayoutExporter::PdfExportSettings &settings, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
254{
255 Q_UNUSED( exporter )
256
257 const QString dest = parameterAsFileOutput( parameters, QStringLiteral( "OUTPUT" ), context );
258
259 QString error;
260 if ( atlas->updateFeatures() )
261 {
262 feedback->pushInfo( QObject::tr( "Exporting %n atlas feature(s)", "", atlas->count() ) );
263 switch ( QgsLayoutExporter::exportToPdf( atlas, dest, settings, error, feedback ) )
264 {
266 {
267 feedback->pushInfo( QObject::tr( "Successfully exported atlas to %1" ).arg( QDir::toNativeSeparators( dest ) ) );
268 break;
269 }
270
272 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Cannot write to %1.\n\nThis file may be open in another application." ).arg( QDir::toNativeSeparators( dest ) ) );
273
275 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Could not create print device." ) );
276
278 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Trying to create the image "
279 "resulted in a memory overflow.\n\n"
280 "Please try a lower resolution or a smaller paper size." ) );
281
283 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Error encountered while exporting atlas." ) );
284
287 // no meaning for PDF exports, will not be encountered
288 break;
289 }
290 }
291 else
292 {
293 feedback->reportError( QObject::tr( "No atlas features found" ) );
294 }
295
296 feedback->setProgress( 100 );
297
298 QVariantMap outputs;
299 outputs.insert( QStringLiteral( "OUTPUT" ), dest );
300 return outputs;
301}
302
303//
304// QgsLayoutAtlasToMultiplePdfAlgorithm
305//
306
307QString QgsLayoutAtlasToMultiplePdfAlgorithm::name() const
308{
309 return QStringLiteral( "atlaslayouttomultiplepdf" );
310}
311
312QString QgsLayoutAtlasToMultiplePdfAlgorithm::displayName() const
313{
314 return QObject::tr( "Export atlas layout as PDF (multiple files)" );
315}
316
317QString QgsLayoutAtlasToMultiplePdfAlgorithm::shortDescription() const
318{
319 return QObject::tr( "Exports an atlas layout to multiple PDF files." );
320}
321
322QString QgsLayoutAtlasToMultiplePdfAlgorithm::shortHelpString() const
323{
324 return QObject::tr( "This algorithm outputs an atlas layout to multiple PDF files.\n\n"
325 "If a coverage layer is set, the selected layout's atlas settings exposed in this algorithm "
326 "will be overwritten. In this case, an empty filter or sort by expression will turn those "
327 "settings off.\n"
328 );
329}
330
331void QgsLayoutAtlasToMultiplePdfAlgorithm::initAlgorithm( const QVariantMap & )
332{
333 QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm();
334 addParameter( new QgsProcessingParameterExpression( QStringLiteral( "OUTPUT_FILENAME" ), QObject::tr( "Output filename" ), QString(), QStringLiteral( "COVERAGE_LAYER" ), true ) );
335 addParameter( new QgsProcessingParameterFile( QStringLiteral( "OUTPUT_FOLDER" ), QObject::tr( "Output folder" ), Qgis::ProcessingFileParameterBehavior::Folder ) );
336}
337
338QgsLayoutAtlasToMultiplePdfAlgorithm *QgsLayoutAtlasToMultiplePdfAlgorithm::createInstance() const
339{
340 return new QgsLayoutAtlasToMultiplePdfAlgorithm();
341}
342
343QVariantMap QgsLayoutAtlasToMultiplePdfAlgorithm::exportAtlas( QgsLayoutAtlas *atlas, const QgsLayoutExporter &exporter, const QgsLayoutExporter::PdfExportSettings &settings, const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
344{
345 Q_UNUSED( exporter )
346
347 QString error;
348
349 const QString filename = parameterAsString( parameters, QStringLiteral( "OUTPUT_FILENAME" ), context );
350 const QString destFolder = parameterAsFile( parameters, QStringLiteral( "OUTPUT_FOLDER" ), context );
351
352 // the "atlas.pdf" part will be overridden, only the folder is important
353 const QString dest = QStringLiteral( "%1/atlas.pdf" ).arg( destFolder );
354
355 if ( atlas->updateFeatures() )
356 {
357 feedback->pushInfo( QObject::tr( "Exporting %n atlas feature(s)", "", atlas->count() ) );
358
360 if ( atlas->filenameExpression().isEmpty() && filename.isEmpty() )
361 {
362 atlas->setFilenameExpression( QStringLiteral( "'output_'||@atlas_featurenumber" ), error );
363 }
364 else if ( !filename.isEmpty() )
365 {
366 if ( !atlas->setFilenameExpression( filename, error ) )
367 {
368 throw QgsProcessingException( QObject::tr( "Output file name expression is not valid: %1" ).arg( error ) );
369 }
370 }
371
372 result = QgsLayoutExporter::exportToPdfs( atlas, dest, settings, error, feedback );
373
374 switch ( result )
375 {
377 {
378 feedback->pushInfo( QObject::tr( "Successfully exported atlas to %1" ).arg( QDir::toNativeSeparators( destFolder ) ) );
379 break;
380 }
381
383 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Cannot write to %1.\n\nThis file may be open in another application." ).arg( QDir::toNativeSeparators( dest ) ) );
384
386 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Could not create print device." ) );
387
389 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Trying to create the image "
390 "resulted in a memory overflow.\n\n"
391 "Please try a lower resolution or a smaller paper size." ) );
392
394 throw QgsProcessingException( !error.isEmpty() ? error : QObject::tr( "Error encountered while exporting atlas." ) );
395
398 // no meaning for PDF exports, will not be encountered
399 break;
400 }
401 }
402 else
403 {
404 feedback->reportError( QObject::tr( "No atlas features found" ) );
405 }
406
407 feedback->setProgress( 100 );
408
409 QVariantMap outputs;
410 outputs.insert( QStringLiteral( "OUTPUT_FOLDER" ), destFolder );
411 return outputs;
412}
413
@ MapLayer
Any map layer type (raster, vector, mesh, point cloud, annotation or plugin layer)
@ Folder
Parameter is a folder.
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
Definition qgis.h:3392
@ PreferText
Render text as text objects, unless doing so results in rendering artifacts or poor quality rendering...
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
@ AlwaysText
Always render text as text objects. While this mode preserves text objects as text for post-processin...
@ NoThreading
Algorithm is not thread safe and cannot be run in a background thread, e.g. for algorithms which mani...
@ RequiresProject
The algorithm requires that a valid QgsProject is available from the processing context in order to e...
@ Advanced
Parameter is an advanced parameter which should be hidden from users by default.
void setProgress(double progress)
Sets the current progress for the feedback object.
Definition qgsfeedback.h:61
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
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.
Stores information relating to the current rendering settings for a layout.
@ FlagLosslessImageRendering
Render images losslessly whenever possible, instead of the default lossy jpeg rendering used for some...
@ FlagDisableTiledRasterLayerRenders
If set, then raster layers will not be drawn as separate tiles. This may improve the appearance in ex...
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 data sets.
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.
QgsLayoutRenderContext::Flags 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....