| | |
| | | layoutView.setContentsMargins(0, 0, 0, 0) |
| | | layoutView.setCurrentLayout(layout) |
| | | |
| | | # project.layoutManager().addLayout(layout) |
| | | # map = QgsLayoutItemMap(layout) |
| | | # map.zoomToExtent(iface.mapCanvas().extent()) |
| | | # # map.zoomToExtent(layers[0].extent()) |
| | | # # map.attemptResize(QgsLayoutSize(2480, 1748, QgsUnitTypes.LayoutPixels)) |
| | | # layout.addItem(map) |
| | | |
| | | # collection = layout.pageCollection() |
| | | # collection.deletePage(0) |
| | | # page = QgsLayoutItemPage(layout) |
| | | # page.setPageSize('A5', True) |
| | | # collection.addPage(page) |
| | | # collection.redraw() |
| | | |
| | | # collection = layout.pageCollection() |
| | | # page = collection.page(0) |
| | | # # QgsUnitTypes.LayoutCentimeters |
| | | # # size = QgsLayoutSize(2480, 1748, QgsUnitTypes.LayoutPixels) |
| | | # page.setPageSize('A5', True) |
| | | |
| | | # imgSetting = QgsLayoutExporter.ImageExportSettings() |
| | | # imgSetting.imageSize.width = 4096 |
| | | # imgSetting.imageSize.heigth = 3507 |
| | | |
| | | # layout.updateBounds() |
| | | # layout.refresh() |
| | | # page.redraw() |
| | | # collection.redraw() |
| | | |
| | | exporter = QgsLayoutExporter(layout) |
| | | img_path = os.path.join("e:/", "render.png") |