1

My QGIS layout manager has several A4 layouts. I would like to export them all to "the same pdf".

I think that by going through the python console it should be possible. for now I can only print one page.... Here is my code:

manager = QgsProject.instance().layoutManager()
exporter = QgsLayoutExporter(layout)
for layout in manager.printLayouts(): 
      print(layout.name())
      exporter.exportToPdf("F:/44.pdf",QgsLayoutExporter.PdfExportSettings())                                                                                                                                                                                                                 

Here is the return: 0, 1, 0, 2

Only page 2 is exported to PDF

  • "Here is the return : 0,1,0,2" : Does that mean you have four layouts ? Does it retrieve the right layout names ? – snaileater Mar 27 at 17:12
  • Hello, I only have two layers and two layouts. I know how to export one or other of the layouts, but I would like to export the 2 layouts in 1 single pdf. – fcka Mar 27 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.