<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Hi Thomas,</div><div class=""><br class=""></div><div class="">Thanks a bunch for your answer and your code. It works like a charm!</div><div class=""><br class=""></div><div class="">However, I'm really bad at coding and I'm not sure why some lines are commented; since your code works without uncommenting these lines, can you tell me what's their purpose?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">Golok</div><div><br class=""><blockquote type="cite" class=""><div class="">On 2 Jan 2022, at 18:00, Thomas Gratier <<a href="mailto:osgeo.mailinglist@gmail.com" class="">osgeo.mailinglist@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi,<br class=""></div><div class=""><br class=""></div><div class="">In startup.py, add the following to register your custom Custom preset format page for print layouts.</div><div class=""><br class=""></div><div class=""><br class=""></div>from qgis.core import QgsApplication, QgsPageSize, QgsLayoutSize, QgsUnitTypes<br class=""><br class="">pageSizeRegistry = QgsApplication.pageSizeRegistry()<br class=""><br class=""># For demo purpose in PyQGIS, so commented<br class=""># print(len(pageSizeRegistry.entries()))<br class=""># print(pageSizeRegistry.entries()[0].size)<br class=""># print(pageSizeRegistry.entries()[0].displayName)<br class=""># print(pageSizeRegistry.entries()[0].name)<br class=""><br class=""># You will see in the menu, myDisplayName with other default preset format pages after executing the following line<br class="">pageSizeRegistry.add(QgsPageSize('myname', QgsLayoutSize(150, 100, units=QgsUnitTypes.LayoutMillimeters), 'myDisplayName'))<br class=""><br class=""><div class=""># print(len(pageSizeRegistry.entries()))</div><div class=""><br class=""></div><div class="">Cheers</div><div class=""><br class=""></div><div class="">Thomas Gratier<br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 29 déc. 2021 à 19:50, Christophe Besuchet <<a href="mailto:design@golok.net" class="">design@golok.net</a>> a écrit :<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello all,<br class="">
<br class="">
I'm often using the same custom page size in my print layouts, and I created several templates for this.<br class="">
<br class="">
However, if I have to add a new page, the later won't inherit my template's format settings; the Size menu will only propose standard presets and I will have to set the size manually (and the guides as well).<br class="">
<br class="">
Is there a way to create and save custom preset format pages so they will show up in the Size menu?<br class="">
<br class="">
In advance thank you for your help!<br class="">
<br class="">
Golok<br class="">
_______________________________________________<br class="">
Qgis-user mailing list<br class="">
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank" class="">Qgis-user@lists.osgeo.org</a><br class="">
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank" class="">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br class="">
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank" class="">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>