16 #ifndef QGSLAYOUTEXPORTER_H
17 #define QGSLAYOUTEXPORTER_H
19 #include "qgis_core.h"
85 void renderPage( QPainter *painter,
int page )
const;
105 QImage renderPageToImage(
int page, QSize imageSize = QSize(),
double dpi = -1 )
const;
114 void renderRegion( QPainter *painter,
const QRectF ®ion )
const;
132 QImage renderRegionToImage(
const QRectF ®ion, QSize imageSize = QSize(),
double dpi = -1 )
const;
176 bool cropToContents =
false;
197 bool generateWorldFile =
false;
205 bool exportMetadata =
true;
211 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags();
266 bool rasterizeWholeImage =
false;
275 bool forceVectorOutput =
false;
282 bool appendGeoreference =
true;
290 bool exportMetadata =
true;
295 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags();
311 bool simplifyGeometries =
true;
324 bool writeGeoPdf =
false;
339 bool exportLayersAsSeperateFiles =
false;
349 bool useIso32000ExtensionFormatGeoreferencing =
true;
360 bool useOgcBestPracticeFormatGeoreferencing =
false;
367 bool includeGeoPdfFeatures =
true;
444 bool rasterizeWholeImage =
false;
449 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags();
498 bool forceVectorOutput =
false;
504 bool cropToContents =
false;
517 bool exportAsLayers =
false;
527 bool exportLabelsToSeparateLayers =
true;
535 bool exportMetadata =
true;
540 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags();
556 bool simplifyGeometries =
true;
610 bool georeferenceOutput(
const QString &file,
QgsLayoutItemMap *referenceMap =
nullptr,
611 const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
619 void computeWorldFileParameters(
double &a,
double &b,
double &
c,
double &d,
double &e,
double &f,
double dpi = -1 )
const;
626 void computeWorldFileParameters(
const QRectF ®ion,
double &a,
double &b,
double &
c,
double &d,
double &e,
double &f,
double dpi = -1 )
const;
635 virtual QString generateFileName(
const PageExportDetails &details )
const;
639 QPointer< QgsLayout > mLayout;
641 mutable QString mErrorFileName;
643 QImage createImage(
const ImageExportSettings &settings,
int page, QRectF &bounds,
bool &skipPage )
const;
649 static int firstPageToBeExported(
QgsLayout *layout );
654 static bool saveImage(
const QImage &image,
const QString &imageFilename,
const QString &imageFormat,
QgsProject *projectForMetadata );
669 std::unique_ptr<double[]> computeGeoTransform(
const QgsLayoutItemMap *referenceMap =
nullptr,
const QRectF &exportRegion = QRectF(),
double dpi = -1 )
const;
672 void writeWorldFile(
const QString &fileName,
double a,
double b,
double c,
double d,
double e,
double f )
const;
677 static void preparePrintAsPdf(
QgsLayout *layout, QPrinter &printer,
const QString &filePath );
679 static void preparePrint(
QgsLayout *layout, QPrinter &printer,
bool setFirstPageSize =
false );
684 ExportResult print( QPrinter &printer );
694 ExportResult printPrivate( QPrinter &printer, QPainter &painter,
bool startNewPage =
false,
double dpi = -1,
bool rasterize =
false );
696 static void updatePrinterPageSize(
QgsLayout *layout, QPrinter &printer,
int page );
698 ExportResult renderToLayeredSvg(
const SvgExportSettings &settings,
double width,
double height,
int page,
const QRectF &bounds,
699 const QString &filename,
unsigned int svgLayerId,
const QString &layerName,
700 QDomDocument &svg, QDomNode &svgDocRoot,
bool includeMetadata )
const;
702 void appendMetadataToSvg( QDomDocument &svg )
const;
704 bool georeferenceOutputPrivate(
const QString &file,
QgsLayoutItemMap *referenceMap =
nullptr,
705 const QRectF &exportRegion = QRectF(),
double dpi = -1,
bool includeGeoreference =
true,
bool includeMetadata =
false )
const;
710 friend class TestQgsLayout;
711 friend class TestQgsLayoutExporter;
715 #endif // ! QT_NO_PRINTER
717 #endif //QGSLAYOUTEXPORTER_H