2

In QGIS we have new layout type: Report. I didn't find tutoral to export this in PDF in Python. Where can I find Python code examples?

2

1 Answer 1

1

QgsLayoutExporter if work with QgsReport, but the way you export it changes a bit.

Here is a basic example of how to export report to PDF

projectInstance = QgsProject.instance()
layoutmanager = projectInstance.layoutManager()
r = layoutmanager.layoutByName("test") #report name
settings = QgsLayoutExporter.PdfExportSettings() # default settings
result, error = QgsLayoutExporter.exportToPdf(r, "D://test.pdf", settings)

exportToPdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.