1 /*************************************************************************** 2 qgslayoutexporter.h 3 ------------------- 4 begin : October 2017 5 copyright : (C) 2017 by Nyall Dawson 6 email : nyall dot dawson at gmail dot com 7 ***************************************************************************/ 8 /*************************************************************************** 9 * * 10 * This program is free software; you can redistribute it and/or modify * 11 * it under the terms of the GNU General Public License as published by * 12 * the Free Software Foundation; either version 2 of the License, or * 13 * (at your option) any later version. * 14 * * 15 ***************************************************************************/ 16 #ifndef QGSLAYOUTEXPORTER_H 17 #define QGSLAYOUTEXPORTER_H 18 19 #include "qgis_core.h" 20 #include "qgsmargins.h" 21 #include "qgslayoutrendercontext.h" 22 #include "qgslayoutreportcontext.h" 23 #include "qgslayoutitem.h" 24 #include <QPointer> 25 #include <QSize> 26 #include <QRectF> 27 #include <functional> 28 29 #ifndef QT_NO_PRINTER 30 #include <QPrinter> 31 32 class QgsLayout; 33 class QPainter; 34 class QgsLayoutItemMap; 35 class QgsAbstractLayoutIterator; 36 class QgsFeedback; 37 38 /** 39 * \ingroup core 40 * \class QgsLayoutExporter 41 * \brief Handles rendering and exports of layouts to various formats. 42 * \since QGIS 3.0 43 */ 44 class CORE_EXPORT QgsLayoutExporter 45 { 46 47 public: 48 49 //! Contains details of a page being exported by the class 50 struct PageExportDetails 51 { 52 //! Target folder 53 QString directory; 54 55 //! Base part of filename (i.e. file name without extension or '.') 56 QString baseName; 57 58 //! File suffix/extension (without the leading '.') 59 QString extension; 60 61 //! Page number, where 0 = first page. 62 int page = 0; 63 }; 64 65 /** 66 * Constructor for QgsLayoutExporter, for the specified \a layout. 67 */ 68 QgsLayoutExporter( QgsLayout *layout ); 69 70 virtual ~QgsLayoutExporter() = default; 71 72 /** 73 * Returns the layout linked to this exporter. 74 */ 75 QgsLayout *layout() const; 76 77 /** 78 * Renders a full page to a destination \a painter. 79 * 80 * The \a page argument specifies the page number to render. Page numbers 81 * are 0 based, such that the first page in a layout is page 0. 82 * 83 * \see renderRegion() 84 */ 85 void renderPage( QPainter *painter, int page ) const; 86 87 /** 88 * Renders a full page to an image. 89 * 90 * The \a page argument specifies the page number to render. Page numbers 91 * are 0 based, such that the first page in a layout is page 0. 92 * 93 * The optional \a imageSize parameter can specify the target image size, in pixels. 94 * It is the caller's responsibility to ensure that the ratio of the target image size 95 * matches the ratio of the corresponding layout page size. 96 * 97 * The \a dpi parameter is an optional dpi override. Set to -1 to use the default layout print 98 * resolution. This parameter has no effect if \a imageSize is specified. 99 * 100 * Returns the rendered image, or a null QImage if the image does not fit into available memory. 101 * 102 * \see renderPage() 103 * \see renderRegionToImage() 104 */ 105 QImage renderPageToImage( int page, QSize imageSize = QSize(), double dpi = -1 ) const; 106 107 /** 108 * Renders a \a region from the layout to a \a painter. This method can be used 109 * to render sections of pages rather than full pages. 110 * 111 * \see renderPage() 112 * \see renderRegionToImage() 113 */ 114 void renderRegion( QPainter *painter, const QRectF ®ion ) const; 115 116 /** 117 * Renders a \a region of the layout to an image. This method can be used to render 118 * sections of pages rather than full pages. 119 * 120 * The optional \a imageSize parameter can specify the target image size, in pixels. 121 * It is the caller's responsibility to ensure that the ratio of the target image size 122 * matches the ratio of the specified region of the layout. 123 * 124 * The \a dpi parameter is an optional dpi override. Set to -1 to use the default layout print 125 * resolution. This parameter has no effect if \a imageSize is specified. 126 * 127 * Returns the rendered image, or a null QImage if the image does not fit into available memory. 128 * 129 * \see renderRegion() 130 * \see renderPageToImage() 131 */ 132 QImage renderRegionToImage( const QRectF ®ion, QSize imageSize = QSize(), double dpi = -1 ) const; 133 134 135 //! Result codes for exporting layouts 136 enum ExportResult 137 { 138 Success, //!< Export was successful 139 Canceled, //!< Export was canceled 140 MemoryError, //!< Unable to allocate memory required to export 141 FileError, //!< Could not write to destination file, likely due to a lock held by another application 142 PrintError, //!< Could not start printing to destination device 143 SvgLayerError, //!< Could not create layered SVG file 144 IteratorError, //!< Error iterating over layout 145 }; 146 147 //! Contains settings relating to exporting layouts to raster images 148 struct ImageExportSettings 149 { 150 //! Constructor for ImageExportSettings ImageExportSettingsImageExportSettings151 ImageExportSettings() 152 : flags( QgsLayoutRenderContext::FlagAntialiasing | QgsLayoutRenderContext::FlagUseAdvancedEffects ) 153 {} 154 155 //! Resolution to export layout at. If dpi <= 0 the default layout dpi will be used. 156 double dpi = -1; 157 158 /** 159 * Manual size in pixels for output image. If imageSize is not 160 * set then it will be automatically calculated based on the 161 * output dpi and layout size. 162 * 163 * If cropToContents is TRUE then imageSize has no effect. 164 * 165 * Be careful when specifying manual sizes if pages in the layout 166 * have differing sizes! It's likely not going to give a reasonable 167 * output in this case, and the automatic dpi-based image size should be 168 * used instead. 169 */ 170 QSize imageSize; 171 172 /** 173 * Set to TRUE if image should be cropped so only parts of the layout 174 * containing items are exported. 175 */ 176 bool cropToContents = false; 177 178 /** 179 * Crop to content margins, in pixels. These margins will be added 180 * to the bounds of the exported layout if cropToContents is TRUE. 181 */ 182 QgsMargins cropMargins; 183 184 /** 185 * List of specific pages to export, or an empty list to 186 * export all pages. 187 * 188 * Page numbers are 0 index based, so the first page in the 189 * layout corresponds to page 0. 190 */ 191 QList< int > pages; 192 193 /** 194 * Set to TRUE to generate an external world file alongside 195 * exported images. 196 */ 197 bool generateWorldFile = false; 198 199 /** 200 * Indicates whether image export should include metadata generated 201 * from the layout's project's metadata. 202 * 203 * \since QGIS 3.2 204 */ 205 bool exportMetadata = true; 206 207 208 /** 209 * Layout context flags, which control how the export will be created. 210 */ 211 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags(); 212 213 /** 214 * A list of predefined scales to use with the layout. This is used 215 * for maps which are set to the predefined atlas scaling mode. 216 * \since QGIS 3.10 217 */ 218 QVector<qreal> predefinedMapScales; 219 220 }; 221 222 /** 223 * Exports the layout to the \a filePath, using the specified export \a settings. 224 * 225 * If the layout is a multi-page layout, then filenames for each page will automatically 226 * be generated by appending "_1", "_2", etc to the image file's base name. 227 * 228 * Returns a result code indicating whether the export was successful or an 229 * error was encountered. If an error code is returned, errorFile() can be called 230 * to determine the filename for the export which encountered the error. 231 */ 232 ExportResult exportToImage( const QString &filePath, const QgsLayoutExporter::ImageExportSettings &settings ); 233 234 235 /** 236 * Exports a layout \a iterator to raster images, with the specified export \a settings. 237 * 238 * The \a baseFilePath argument gives a base file path, which is modified by the 239 * iterator to obtain file paths for each iterator feature. 240 * 241 * Returns a result code indicating whether the export was successful or an 242 * error was encountered. If an error was obtained then \a error will be set 243 * to the error description. 244 */ 245 static ExportResult exportToImage( QgsAbstractLayoutIterator *iterator, const QString &baseFilePath, 246 const QString &extension, const QgsLayoutExporter::ImageExportSettings &settings, 247 QString &error SIP_OUT, QgsFeedback *feedback = nullptr ); 248 249 250 //! Contains settings relating to exporting layouts to PDF 251 struct PdfExportSettings 252 { 253 //! Constructor for PdfExportSettings PdfExportSettingsPdfExportSettings254 PdfExportSettings() 255 : flags( QgsLayoutRenderContext::FlagAntialiasing | QgsLayoutRenderContext::FlagUseAdvancedEffects ) 256 {} 257 258 //! Resolution to export layout at. If dpi <= 0 the default layout dpi will be used. 259 double dpi = -1; 260 261 /** 262 * Set to TRUE to force whole layout to be rasterized while exporting. 263 * 264 * This option is mutually exclusive with forceVectorOutput. 265 */ 266 bool rasterizeWholeImage = false; 267 268 /** 269 * Set to TRUE to force vector object exports, even when the resultant appearance will differ 270 * from the layout. If FALSE, some items may be rasterized in order to maintain their 271 * correct appearance in the output. 272 * 273 * This option is mutually exclusive with rasterizeWholeImage. 274 */ 275 bool forceVectorOutput = false; 276 277 /** 278 * Indicates whether PDF export should append georeference data 279 * 280 * \since QGIS 3.10 281 */ 282 bool appendGeoreference = true; 283 284 /** 285 * Indicates whether PDF export should include metadata generated 286 * from the layout's project's metadata. 287 * 288 * \since QGIS 3.2 289 */ 290 bool exportMetadata = true; 291 292 /** 293 * Layout context flags, which control how the export will be created. 294 */ 295 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags(); 296 297 /** 298 * Text rendering format, which controls how text should be rendered in the export (e.g. 299 * as paths or real text objects). 300 * 301 * \since QGIS 3.4.3 302 */ 303 QgsRenderContext::TextRenderFormat textRenderFormat = QgsRenderContext::TextFormatAlwaysOutlines; 304 305 /** 306 * Indicates whether vector geometries should be simplified to avoid redundant extraneous detail, 307 * such as vertices which are not visible at the specified dpi of the output. 308 * 309 * \since QGIS 3.10 310 */ 311 bool simplifyGeometries = true; 312 313 /** 314 * TRUE if GeoPDF files should be created, instead of normal PDF files. 315 * 316 * Whilst GeoPDF files can include some desirable properties like the ability to interactively 317 * query map features, they also can result in lower-quality output files, or forced rasterization 318 * of layers. 319 * 320 * \note Requires builds based on GDAL 3.0 or greater. 321 * 322 * \since QGIS 3.10 323 */ 324 bool writeGeoPdf = false; 325 326 /** 327 * TRUE if individual layers from the layout should be rendered to separate PDF files. 328 * 329 * This option allows for separation of logic layout layers to individual PDF files. For instance, 330 * if this option is TRUE, then a separate PDF file will be created per layer per map item in the 331 * layout. Additionally, separate PDF files may be created for other complex layout items, resulting 332 * in a set of PDF files which contain logical atomic components of the layout. 333 * 334 * This option is designed to allow the PDF files to be composited back together in an external 335 * application (e.g. Adobe Illustrator) as a non-QGIS, post-production step. 336 * 337 * \since QGIS 3.14 338 */ 339 bool exportLayersAsSeperateFiles = false; // TODO QGIS 4 fix typo //#spellok 340 341 /** 342 * TRUE if ISO3200 extension format georeferencing should be used. 343 * 344 * This is a recommended setting which results in Geospatial PDF files compatible 345 * with the built-in Acrobat geospatial tools. 346 * 347 * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. 348 */ 349 bool useIso32000ExtensionFormatGeoreferencing = true; 350 351 /** 352 * TRUE if OGC "best practice" format georeferencing should be used. 353 * 354 * \warning This results in GeoPDF files compatible with the TerraGo suite of tools, but 355 * can break compatibility with the built-in Acrobat geospatial tools (yes, GeoPDF 356 * format is a mess!). 357 * 358 * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. 359 */ 360 bool useOgcBestPracticeFormatGeoreferencing = false; 361 362 /** 363 * TRUE if feature vector information (such as attributes) should be exported during GeoPDF exports. 364 * 365 * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. 366 */ 367 bool includeGeoPdfFeatures = true; 368 369 /** 370 * Optional list of map themes to export as GeoPDF layer groups. 371 * 372 * If set, map item's which are not assigned a specific map theme will iterate through all listed 373 * themes and a GeoPDF layer group will be created for each. 374 * 375 * If PdfExportSettings::writeGeoPdf is FALSE than this option has no effect. 376 */ 377 QStringList exportThemes; 378 379 /** 380 * A list of predefined scales to use with the layout. This is used 381 * for maps which are set to the predefined atlas scaling mode. 382 * \since QGIS 3.10 383 */ 384 QVector<qreal> predefinedMapScales; 385 386 }; 387 388 /** 389 * Exports the layout as a PDF to the \a filePath, using the specified export \a settings. 390 * 391 * Returns a result code indicating whether the export was successful or an 392 * error was encountered. 393 */ 394 ExportResult exportToPdf( const QString &filePath, const QgsLayoutExporter::PdfExportSettings &settings ); 395 396 /** 397 * Exports a layout \a iterator to a single PDF file, with the specified export \a settings. 398 * 399 * The \a fileName argument gives the destination file name for the output PDF. 400 * 401 * Returns a result code indicating whether the export was successful or an 402 * error was encountered. If an error was obtained then \a error will be set 403 * to the error description. 404 * 405 * \see exportToPdfs() 406 */ 407 static ExportResult exportToPdf( QgsAbstractLayoutIterator *iterator, const QString &fileName, 408 const QgsLayoutExporter::PdfExportSettings &settings, 409 QString &error SIP_OUT, QgsFeedback *feedback = nullptr ); 410 411 /** 412 * Exports a layout \a iterator to multiple PDF files, with the specified export \a settings. 413 * 414 * The \a baseFilePath argument gives a base file path, which is modified by the 415 * iterator to obtain file paths for each iterator feature. 416 * 417 * Returns a result code indicating whether the export was successful or an 418 * error was encountered. If an error was obtained then \a error will be set 419 * to the error description. 420 * 421 * \see exportToPdf() 422 */ 423 static ExportResult exportToPdfs( QgsAbstractLayoutIterator *iterator, const QString &baseFilePath, 424 const QgsLayoutExporter::PdfExportSettings &settings, 425 QString &error SIP_OUT, QgsFeedback *feedback = nullptr ); 426 427 428 //! Contains settings relating to printing layouts 429 struct PrintExportSettings 430 { 431 //! Constructor for PrintExportSettings PrintExportSettingsPrintExportSettings432 PrintExportSettings() 433 : flags( QgsLayoutRenderContext::FlagAntialiasing | QgsLayoutRenderContext::FlagUseAdvancedEffects ) 434 {} 435 436 //! Resolution to export layout at. If dpi <= 0 the default layout dpi will be used. 437 double dpi = -1; 438 439 /** 440 * Set to TRUE to force whole layout to be rasterized while exporting. 441 * 442 * This option is mutually exclusive with forceVectorOutput. 443 */ 444 bool rasterizeWholeImage = false; 445 446 /** 447 * Layout context flags, which control how the export will be created. 448 */ 449 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags(); 450 451 /** 452 * A list of predefined scales to use with the layout. This is used 453 * for maps which are set to the predefined atlas scaling mode. 454 * \since QGIS 3.10 455 */ 456 QVector<qreal> predefinedMapScales; 457 458 }; 459 460 /** 461 * Prints the layout to a \a printer, using the specified export \a settings. 462 * 463 * Returns a result code indicating whether the export was successful or an 464 * error was encountered. 465 */ 466 ExportResult print( QPrinter &printer, const QgsLayoutExporter::PrintExportSettings &settings ); 467 468 /** 469 * Exports a layout \a iterator to a \a printer, with the specified export \a settings. 470 * 471 * Returns a result code indicating whether the export was successful or an 472 * error was encountered. If an error was obtained then \a error will be set 473 * to the error description. 474 */ 475 static ExportResult print( QgsAbstractLayoutIterator *iterator, QPrinter &printer, 476 const QgsLayoutExporter::PrintExportSettings &settings, 477 QString &error SIP_OUT, QgsFeedback *feedback = nullptr ); 478 479 480 //! Contains settings relating to exporting layouts to SVG 481 struct SvgExportSettings 482 { 483 //! Constructor for SvgExportSettings SvgExportSettingsSvgExportSettings484 SvgExportSettings() 485 : flags( QgsLayoutRenderContext::FlagAntialiasing | QgsLayoutRenderContext::FlagUseAdvancedEffects ) 486 {} 487 488 //! Resolution to export layout at. If dpi <= 0 the default layout dpi will be used. 489 double dpi = -1; 490 491 /** 492 * Set to TRUE to force vector object exports, even when the resultant appearance will differ 493 * from the layout. If FALSE, some items may be rasterized in order to maintain their 494 * correct appearance in the output. 495 * 496 * This option is mutually exclusive with rasterizeWholeImage. 497 */ 498 bool forceVectorOutput = false; 499 500 /** 501 * Set to TRUE if image should be cropped so only parts of the layout 502 * containing items are exported. 503 */ 504 bool cropToContents = false; 505 506 /** 507 * Crop to content margins, in layout units. These margins will be added 508 * to the bounds of the exported layout if cropToContents is TRUE. 509 */ 510 QgsMargins cropMargins; 511 512 /** 513 * Set to TRUE to export as a layered SVG file. 514 * Note that this option is considered experimental, and the generated 515 * SVG may differ from the expected appearance of the layout. 516 */ 517 bool exportAsLayers = false; 518 519 /** 520 * Set to TRUE to export labels to separate layers (grouped by map layer) 521 * in layered SVG exports. 522 * 523 * This option is only used if exportAsLayers is TRUE. 524 * 525 * \since QGIS 3.10 526 */ 527 bool exportLabelsToSeparateLayers = true; 528 529 /** 530 * Indicates whether SVG export should include RDF metadata generated 531 * from the layout's project's metadata. 532 * 533 * \since QGIS 3.2 534 */ 535 bool exportMetadata = true; 536 537 /** 538 * Layout context flags, which control how the export will be created. 539 */ 540 QgsLayoutRenderContext::Flags flags = QgsLayoutRenderContext::Flags(); 541 542 /** 543 * Text rendering format, which controls how text should be rendered in the export (e.g. 544 * as paths or real text objects). 545 * 546 * \since QGIS 3.4.3 547 */ 548 QgsRenderContext::TextRenderFormat textRenderFormat = QgsRenderContext::TextFormatAlwaysOutlines; 549 550 /** 551 * Indicates whether vector geometries should be simplified to avoid redundant extraneous detail, 552 * such as vertices which are not visible at the specified dpi of the output. 553 * 554 * \since QGIS 3.10 555 */ 556 bool simplifyGeometries = true; 557 558 /** 559 * A list of predefined scales to use with the layout. This is used 560 * for maps which are set to the predefined atlas scaling mode. 561 * \since QGIS 3.10 562 */ 563 QVector<qreal> predefinedMapScales; 564 }; 565 566 /** 567 * Exports the layout as an SVG to the \a filePath, using the specified export \a settings. 568 * 569 * Returns a result code indicating whether the export was successful or an 570 * error was encountered. 571 */ 572 ExportResult exportToSvg( const QString &filePath, const QgsLayoutExporter::SvgExportSettings &settings ); 573 574 /** 575 * Exports a layout \a iterator to SVG files, with the specified export \a settings. 576 * 577 * The \a baseFilePath argument gives a base file path, which is modified by the 578 * iterator to obtain file paths for each iterator feature. 579 * 580 * Returns a result code indicating whether the export was successful or an 581 * error was encountered. If an error was obtained then \a error will be set 582 * to the error description. 583 */ 584 static ExportResult exportToSvg( QgsAbstractLayoutIterator *iterator, const QString &baseFilePath, 585 const QgsLayoutExporter::SvgExportSettings &settings, 586 QString &error SIP_OUT, QgsFeedback *feedback = nullptr ); 587 588 589 /** 590 * Returns the file name corresponding to the last error encountered during 591 * an export. 592 */ errorFile()593 QString errorFile() const { return mErrorFileName; } 594 595 /** 596 * Georeferences a \a file (image of PDF) exported from the layout. 597 * 598 * The \a referenceMap argument specifies a map item to use for georeferencing. If left as NULLPTR, the 599 * default layout QgsLayout::referenceMap() will be used. 600 * 601 * The \a exportRegion argument can be set to a valid rectangle to indicate that only part of the layout was 602 * exported. 603 * 604 * Similarly, the \a dpi can be set to the actual DPI of exported file, or left as -1 to use the layout's default DPI. 605 * 606 * The function will return TRUE if the output was successfully georeferenced. 607 * 608 * \see computeWorldFileParameters() 609 */ 610 bool georeferenceOutput( const QString &file, QgsLayoutItemMap *referenceMap = nullptr, 611 const QRectF &exportRegion = QRectF(), double dpi = -1 ) const; 612 613 /** 614 * Compute world file parameters. Assumes the whole page containing the reference map item 615 * will be exported. 616 * 617 * The \a dpi argument can be set to the actual DPI of exported file, or left as -1 to use the layout's default DPI. 618 */ 619 void computeWorldFileParameters( double &a, double &b, double &c, double &d, double &e, double &f, double dpi = -1 ) const; 620 621 /** 622 * Computes the world file parameters for a specified \a region of the layout. 623 * 624 * The \a dpi argument can be set to the actual DPI of exported file, or left as -1 to use the layout's default DPI. 625 */ 626 void computeWorldFileParameters( const QRectF ®ion, double &a, double &b, double &c, double &d, double &e, double &f, double dpi = -1 ) const; 627 628 protected: 629 630 /** 631 * Generates the file name for a page during export. 632 * 633 * Subclasses can override this method to customize page file naming. 634 */ 635 virtual QString generateFileName( const PageExportDetails &details ) const; 636 637 private: 638 639 QPointer< QgsLayout > mLayout; 640 641 mutable QString mErrorFileName; 642 643 QImage createImage( const ImageExportSettings &settings, int page, QRectF &bounds, bool &skipPage ) const; 644 645 /** 646 * Returns the page number of the first page to be exported from the layout, skipping any pages 647 * which have been excluded from export. 648 */ 649 static int firstPageToBeExported( QgsLayout *layout ); 650 651 /** 652 * Saves an image to a file, possibly using format specific options (e.g. LZW compression for tiff) 653 */ 654 static bool saveImage( const QImage &image, const QString &imageFilename, const QString &imageFormat, QgsProject *projectForMetadata ); 655 656 /** 657 * Computes a GDAL style geotransform for georeferencing a layout. 658 * 659 * The \a referenceMap argument specifies a map item to use for georeferencing. If left as NULLPTR, the 660 * default layout QgsLayout::referenceMap() will be used. 661 * 662 * The \a exportRegion argument can be set to a valid rectangle to indicate that only part of the layout was 663 * exported. 664 * 665 * Similarly, the \a dpi can be set to the actual DPI of exported file, or left as -1 to use the layout's default DPI. 666 * 667 * \see georeferenceOutput() 668 */ 669 std::unique_ptr<double[]> computeGeoTransform( const QgsLayoutItemMap *referenceMap = nullptr, const QRectF &exportRegion = QRectF(), double dpi = -1 ) const; 670 671 //! Write a world file 672 void writeWorldFile( const QString &fileName, double a, double b, double c, double d, double e, double f ) const; 673 674 /** 675 * Prepare a \a printer for printing a layout as a PDF, to the destination \a filePath. 676 */ 677 static void preparePrintAsPdf( QgsLayout *layout, QPrinter &printer, const QString &filePath ); 678 679 static void preparePrint( QgsLayout *layout, QPrinter &printer, bool setFirstPageSize = false ); 680 681 /** 682 * Convenience function that prepares the printer and prints. 683 */ 684 ExportResult print( QPrinter &printer ); 685 686 /** 687 * Print on a preconfigured printer 688 * \param printer QPrinter destination 689 * \param painter QPainter source 690 * \param startNewPage set to TRUE to begin the print on a new page 691 * \param dpi set to a value > 0 to manually override the layout's default dpi 692 * \param rasterize set to TRUE to force print as a raster image 693 */ 694 ExportResult printPrivate( QPrinter &printer, QPainter &painter, bool startNewPage = false, double dpi = -1, bool rasterize = false ); 695 696 static void updatePrinterPageSize( QgsLayout *layout, QPrinter &printer, int page ); 697 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; 701 702 void appendMetadataToSvg( QDomDocument &svg ) const; 703 704 bool georeferenceOutputPrivate( const QString &file, QgsLayoutItemMap *referenceMap = nullptr, 705 const QRectF &exportRegion = QRectF(), double dpi = -1, bool includeGeoreference = true, bool includeMetadata = false ) const; 706 707 ExportResult handleLayeredExport( const QList<QGraphicsItem *> &items, const std::function<QgsLayoutExporter::ExportResult( unsigned int layerId, const QgsLayoutItem::ExportLayerDetail &layerDetails )> &exportFunc ); 708 709 static QgsVectorSimplifyMethod createExportSimplifyMethod(); 710 friend class TestQgsLayout; 711 friend class TestQgsLayoutExporter; 712 713 }; 714 715 #endif // ! QT_NO_PRINTER 716 717 #endif //QGSLAYOUTEXPORTER_H 718 719 720 721