From d8ce4e1d7fe96410a5fab96f46649280024ab2d9 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 07 十一月 2022 16:35:49 +0800
Subject: [PATCH] 1

---
 QGIS/render_bak.py |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/QGIS/render_bak.py b/QGIS/render_bak.py
index 9cc55bc..56741be 100644
--- a/QGIS/render_bak.py
+++ b/QGIS/render_bak.py
@@ -51,9 +51,32 @@
 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")

--
Gitblit v1.9.3