<div dir="ltr">Hello everyone.<div>I'm new in QGIS. </div><div>My question is: I'm trying to layout with PYQGIS, I understand that there is one way to initialize automatically the layout configurations that is with the function initializeDefaluts(), that adds a A4 page in landscape orientation. But I want to layout without this function because I need a different page size and orientation.</div><div>I tried with this code in the python console:</div><div><br></div><div>project = QgsProject().instance()</div><div>layout = QgsPrintLayout(project)<br>page = QgsLayoutItemPage(layout)</div><div>#set page orientation vertically and a letter size<br>page.setPageSize("Letter", 0)<br>layout.addLayoutItem(page)</div><div>#set the layout name for the layout manager<br>layout.setName("MyLayout")</div><div>#add the layout to the layout manager <br>project.layoutManager().addLayout(layout)<br></div><div><br></div><div><br></div><div>When I open the layout made with this code in the the layout manager I note that the variable layout_numpages is set to 0, that means that I can't add guides because there are no pages to link guides and I can't use the rulers because the 0 of y rulers is at the coordinates (0,10)mm. Then, there are other variables with different values (layout_pageheight, layout_pageoffset and layout _page width).</div><div><br></div><div>Could someone tell me what is needed to build a layout without that function and correcting the rulers and the layout_numpage variable?</div><div><br></div><div>Thanks</div><div><br></div><div>M. Rubiano</div></div>