Skip to main content
Tweeted twitter.com/StackGIS/status/1405268977513746437
Tiny changes
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

Exporting multipages Atlas with predefined layout in one PDF file in QGIS 3.x I want to get a PDF export of my atlas in only one PDF File in QGIS 3.16. I've written the below code so far with the help of this previously answered question: PyQGIS control creation Atlas Layout

iface.addProject(myAtlasProject)
project = QgsProject.instance()
project.read(myAtlasProject)
manager = project.layoutManager()
layoutName = "Layout1"
layout = manager.layoutByName(layoutName)

for comp in manager.printLayouts():
    comp.atlas().beginRender()
    comp.atlas().first()
    for i in range(0, comp.atlas().count()):
        settingspdf = QgsLayoutExporter.PdfExportSettings()
        exporter =  QgsLayoutExporter(comp.atlas().layout () )
        comp.atlas().next()
    exporter.exportToPdf('c:/temp/+comp.atlas().currentFilename()+".pdf", settingspdf)
comp.atlas().endRender()
iface.addProject(myAtlasProject)
project = QgsProject.instance()
project.read(myAtlasProject)
manager = project.layoutManager()
layoutName = "Layout1"
layout = manager.layoutByName(layoutName)

for comp in manager.printLayouts():
    comp.atlas().beginRender()
    comp.atlas().first()
    for i in range(0, comp.atlas().count()):
        settingspdf = QgsLayoutExporter.PdfExportSettings()
        exporter =  QgsLayoutExporter(comp.atlas().layout () )
        comp.atlas().next()
    exporter.exportToPdf("c:/temp/"+comp.atlas().currentFilename()+".pdf", settingspdf)
comp.atlas().endRender()

Now the problem is that I get separate pages each time. However I want a single PDF export that contains all the pages. Can somebody help me with that?

Exporting multipages Atlas with predefined layout in one PDF file in QGIS 3.x I want to get a PDF export of my atlas in only one PDF File in QGIS 3.16. I've written the below code so far with the help of this previously answered question: PyQGIS control creation Atlas Layout

iface.addProject(myAtlasProject)
project = QgsProject.instance()
project.read(myAtlasProject)
manager = project.layoutManager()
layoutName = "Layout1"
layout = manager.layoutByName(layoutName)

for comp in manager.printLayouts():
    comp.atlas().beginRender()
    comp.atlas().first()
    for i in range(0, comp.atlas().count()):
        settingspdf = QgsLayoutExporter.PdfExportSettings()
        exporter =  QgsLayoutExporter(comp.atlas().layout () )
        comp.atlas().next()
    exporter.exportToPdf('c:/temp/+comp.atlas().currentFilename()+".pdf", settingspdf)
comp.atlas().endRender()

Now the problem is that I get separate pages each time. However I want a single PDF export that contains all the pages. Can somebody help me with that?

Exporting multipages Atlas with predefined layout in one PDF file in QGIS 3.x I want to get a PDF export of my atlas in only one PDF File in QGIS 3.16. I've written the below code so far with the help of this previously answered question: PyQGIS control creation Atlas Layout

iface.addProject(myAtlasProject)
project = QgsProject.instance()
project.read(myAtlasProject)
manager = project.layoutManager()
layoutName = "Layout1"
layout = manager.layoutByName(layoutName)

for comp in manager.printLayouts():
    comp.atlas().beginRender()
    comp.atlas().first()
    for i in range(0, comp.atlas().count()):
        settingspdf = QgsLayoutExporter.PdfExportSettings()
        exporter =  QgsLayoutExporter(comp.atlas().layout () )
        comp.atlas().next()
    exporter.exportToPdf("c:/temp/"+comp.atlas().currentFilename()+".pdf", settingspdf)
comp.atlas().endRender()

Now the problem is that I get separate pages each time. However I want a single PDF export that contains all the pages. Can somebody help me with that?

Source Link

Exporting multipages Atlas with predefined layout in one PDF file in QGIS 3.x

Exporting multipages Atlas with predefined layout in one PDF file in QGIS 3.x I want to get a PDF export of my atlas in only one PDF File in QGIS 3.16. I've written the below code so far with the help of this previously answered question: PyQGIS control creation Atlas Layout

iface.addProject(myAtlasProject)
project = QgsProject.instance()
project.read(myAtlasProject)
manager = project.layoutManager()
layoutName = "Layout1"
layout = manager.layoutByName(layoutName)

for comp in manager.printLayouts():
    comp.atlas().beginRender()
    comp.atlas().first()
    for i in range(0, comp.atlas().count()):
        settingspdf = QgsLayoutExporter.PdfExportSettings()
        exporter =  QgsLayoutExporter(comp.atlas().layout () )
        comp.atlas().next()
    exporter.exportToPdf('c:/temp/+comp.atlas().currentFilename()+".pdf", settingspdf)
comp.atlas().endRender()

Now the problem is that I get separate pages each time. However I want a single PDF export that contains all the pages. Can somebody help me with that?