From 4ba319270563d27ec0b19827d97e6a901cd5898d Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 10 十一月 2022 15:45:52 +0800
Subject: [PATCH] 1

---
 ExportMap/Sources/render.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ExportMap/Sources/render.py b/ExportMap/Sources/render.py
index e6952ff..1c4da43 100644
--- a/ExportMap/Sources/render.py
+++ b/ExportMap/Sources/render.py
@@ -82,11 +82,14 @@
 
 # map = layout.itemById(r'鍦板浘')
 map = layout.referenceMap()
-# map.zoomToExtent(map.extent())
+map.zoomToExtent(map.extent())
 print('1:' + str(math.ceil(map.scale())))
 
 size = map.sizeWithUnits()
 print('size: ' + str(size.width()) + " * " + str(size.height()) + " mm")
+if size.width() > 280 or size.height() > 174:
+    map.attemptResize(QgsLayoutSize(280, 174, QgsUnitTypes.LayoutMillimeters))
+    print('size: ' + str(map.sizeWithUnits().width()) + " * " + str(map.sizeWithUnits().height()) + " mm")
 
 # 璁剧疆鍥惧眰
 # "闃�瀹�", "绔欏満", "绠¢亾涓績绾�", "鐭㈤噺娉ㄨ", "鐭㈤噺鍥�", "楂樺痉褰卞儚娉ㄨ", "楂樺痉褰卞儚", "褰卞儚娉ㄨ", "褰卞儚鍥�"

--
Gitblit v1.9.3