16 #ifndef QGSLAYOUTEXPORTER_H 17 #define QGSLAYOUTEXPORTER_H 20 #include "qgis_core.h" 83 void renderPage( QPainter *painter,
int page )
const;
103 QImage renderPageToImage(
int page, QSize imageSize = QSize(),
double dpi = -1 )
const;
112 void renderRegion( QPainter *painter,
const QRectF ®ion )
const;
130 QImage renderRegionToImage(
const QRectF ®ion, QSize imageSize = QSize(),
double dpi = -1 )
const;
174 bool cropToContents =
false;
195 bool generateWorldFile =
false;
203 bool exportMetadata =
true;
209 QgsLayoutRenderContext::Flags flags =
nullptr;
257 bool rasterizeWholeImage =
false;
266 bool forceVectorOutput =
false;
274 bool exportMetadata =
true;
279 QgsLayoutRenderContext::Flags flags =
nullptr;
347 bool rasterizeWholeImage =
false;
352 QgsLayoutRenderContext::Flags flags =
nullptr;
394 bool forceVectorOutput =
false;
400 bool cropToContents =
false;
413 bool exportAsLayers =
false;
421 bool exportMetadata =
true;
426 QgsLayoutRenderContext::Flags flags =
nullptr;
482 bool georeferenceOutput(
const QString &file,
QgsLayoutItemMap *referenceMap =
nullptr,
483 const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
491 void computeWorldFileParameters(
double &a,
double &b,
double &
c,
double &d,
double &e,
double &f,
double dpi = -1 )
const;
498 void computeWorldFileParameters(
const QRectF ®ion,
double &a,
double &b,
double &c,
double &d,
double &e,
double &f,
double dpi = -1 )
const;
511 QPointer< QgsLayout > mLayout;
513 mutable QString mErrorFileName;
515 QImage createImage(
const ImageExportSettings &settings,
int page, QRectF &bounds,
bool &skipPage )
const;
521 static int firstPageToBeExported(
QgsLayout *layout );
526 static bool saveImage(
const QImage &image,
const QString &imageFilename,
const QString &imageFormat,
QgsProject *projectForMetadata );
541 std::unique_ptr<double[]> computeGeoTransform(
const QgsLayoutItemMap *referenceMap =
nullptr,
const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
544 void writeWorldFile(
const QString &fileName,
double a,
double b,
double c,
double d,
double e,
double f )
const;
549 static void preparePrintAsPdf(
QgsLayout *layout, QPrinter &printer,
const QString &filePath );
551 static void preparePrint(
QgsLayout *layout, QPrinter &printer,
bool setFirstPageSize =
false );
566 ExportResult printPrivate( QPrinter &printer, QPainter &painter,
bool startNewPage =
false,
double dpi = -1,
bool rasterize =
false );
568 static void updatePrinterPageSize(
QgsLayout *layout, QPrinter &printer,
int page );
571 const QString &filename,
int svgLayerId,
const QString &layerName,
572 QDomDocument &svg, QDomNode &svgDocRoot,
bool includeMetadata )
const;
574 void appendMetadataToSvg( QDomDocument &svg )
const;
576 bool georeferenceOutputPrivate(
const QString &file,
QgsLayoutItemMap *referenceMap =
nullptr,
577 const QRectF &exportRegion = QRectF(),
double dpi = -1,
bool includeGeoreference =
true,
bool includeMetadata =
false )
const;
579 friend class TestQgsLayout;
583 #endif // ! QT_NO_PRINTER 585 #endif //QGSLAYOUTEXPORTER_H
Contains settings relating to printing layouts.
QgsMargins cropMargins
Crop to content margins, in layout units.
Unable to allocate memory required to export.
Could not write to destination file, likely due to a lock held by another application.
QString errorFile() const
Returns the file name corresponding to the last error encountered during an export.
QgsMargins cropMargins
Crop to content margins, in pixels.
QList< int > pages
List of specific pages to export, or an empty list to export all pages.
QString directory
Target folder.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Contains details of a page being exported by the class.
QSize imageSize
Manual size in pixels for output image.
Layout graphical items for displaying a map.
An abstract base class for QgsLayout based classes which can be exported by QgsLayoutExporter.
Always render text using path objects (AKA outlines/curves).
QString extension
File suffix/extension (without the leading '.')
Reads and writes project states.
QString baseName
Base part of filename (i.e. file name without extension or '.')
Could not create layered SVG file.
ImageExportSettings()
Constructor for ImageExportSettings.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
TextRenderFormat
Options for rendering text.
PrintExportSettings()
Constructor for PrintExportSettings.
PdfExportSettings()
Constructor for PdfExportSettings.
SvgExportSettings()
Constructor for SvgExportSettings.
Handles rendering and exports of layouts to various formats.
Contains settings relating to exporting layouts to PDF.
Contains settings relating to exporting layouts to raster images.
Stores information relating to the current rendering settings for a layout.
Could not start printing to destination device.
Contains settings relating to exporting layouts to SVG.
The QgsMargins class defines the four margins of a rectangle.
ExportResult
Result codes for exporting layouts.
Error iterating over layout.