16 #ifndef QGSLAYOUTEXPORTER_H 17 #define QGSLAYOUTEXPORTER_H 19 #include "qgis_core.h" 80 void renderPage( QPainter *painter,
int page )
const;
100 QImage renderPageToImage(
int page, QSize imageSize = QSize(),
double dpi = 0 )
const;
109 void renderRegion( QPainter *painter,
const QRectF ®ion )
const;
127 QImage renderRegionToImage(
const QRectF ®ion, QSize imageSize = QSize(),
double dpi = 0 )
const;
171 bool cropToContents =
false;
192 bool generateWorldFile =
false;
197 QgsLayoutRenderContext::Flags flags = 0;
245 bool rasterizeWholeImage =
false;
254 bool forceVectorOutput =
false;
259 QgsLayoutRenderContext::Flags flags = 0;
319 bool rasterizeWholeImage =
false;
324 QgsLayoutRenderContext::Flags flags = 0;
366 bool forceVectorOutput =
false;
372 bool cropToContents =
false;
385 bool exportAsLayers =
false;
390 QgsLayoutRenderContext::Flags flags = 0;
438 bool georeferenceOutput(
const QString &file,
QgsLayoutItemMap *referenceMap =
nullptr,
439 const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
447 void computeWorldFileParameters(
double &a,
double &b,
double &c,
double &d,
double &e,
double &
f,
double dpi = -1 )
const;
454 void computeWorldFileParameters(
const QRectF ®ion,
double &a,
double &b,
double &c,
double &d,
double &e,
double &f,
double dpi = -1 )
const;
467 QPointer< QgsLayout > mLayout;
469 mutable QString mErrorFileName;
471 QImage createImage(
const ImageExportSettings &settings,
int page, QRectF &bounds,
bool &skipPage )
const;
476 static bool saveImage(
const QImage &image,
const QString &imageFilename,
const QString &imageFormat );
491 std::unique_ptr<double[]> computeGeoTransform(
const QgsLayoutItemMap *referenceMap =
nullptr,
const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
494 void writeWorldFile(
const QString &fileName,
double a,
double b,
double c,
double d,
double e,
double f )
const;
499 static void preparePrintAsPdf(
QgsLayout *layout, QPrinter &printer,
const QString &filePath );
501 static void preparePrint(
QgsLayout *layout, QPrinter &printer,
bool setFirstPageSize =
false );
516 ExportResult printPrivate( QPrinter &printer, QPainter &painter,
bool startNewPage =
false,
double dpi = -1,
bool rasterize =
false );
518 static void updatePrinterPageSize(
QgsLayout *layout, QPrinter &printer,
int page );
521 const QString &filename,
int svgLayerId,
const QString &layerName,
522 QDomDocument &svg, QDomNode &svgDocRoot )
const;
524 friend class TestQgsLayout;
528 #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 cancelation of something running in a worker thread...
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.
QString extension
File suffix/extension (without the leading '.')
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.
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.