Using Python to programmatically style data and create maps. Plugin Development:
The PyQGIS Programmer's Guide: Extending QGIS 3 with Python 3 Gary Sherman (founder of the QGIS project). pyqgis programmer 39s guide 3 pdf work
| Issue | PyQGIS Solution | |-------|----------------| | PDF text renders as boxes | Install missing fonts on the server. Use QgsFontUtils to fallback to a safe font like Arial. | | Raster layers are blurry | Increase PdfExportSettings.dpi to 600 or use rasterizeWholeImage=False (be careful with complex symbology). | | Layout exporter crashes headless | You must instantiate a QgsApplication and set setAttribute(Qt.AA_EnableHighDpiScaling) before any layout operations. | | Memory leak when exporting 1000+ PDFs | Use QgsLayoutExporter inside a loop but call QgsProject.instance().clear() and QgsApplication.processEvents() after each batch. | | Map labels shift between PDF and GUI | Disable label placement engine; use labelSettings.setPlacement(QgsLabelingEngine.SimplePlacement) in the layout map item. | Using Python to programmatically style data and create maps