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?
1 Answer
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)