User Tools

Site Tools


exporting_multiple_layouts

The following PyQGIS script is useful when wanting to export out multiple layouts from a QGIS project. It will export out all layouts from a project into the project folder. Handy when you've made tweaks to the base map:

import os
project_instance = QgsProject.instance()
manager = project_instance.layoutManager()

for layout in manager.layouts():
    exporter = QgsLayoutExporter(layout)
    outpath = os.path.join(project_instance.homePath(), layout.name() + ".pdf")
    exporter.exportToPdf(outpath, QgsLayoutExporter.PdfExportSettings())

There may be plugins available that achieve the same/similar things, but this script is a handy one to have.

exporting_multiple_layouts.txt · Last modified: 2023/08/28 08:49 by bushwalking

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki