I want to include the print size of my layout (e.g. "A3") as part of a label on the map, how can I write an expression to capture this information automatically?
I am using QGIS 3.12.
I want to include the print size of my layout (e.g. "A3") as part of a label on the map, how can I write an expression to capture this information automatically?
I am using QGIS 3.12.
When in print layout you can add a new Label to the layout and in the item properties click on insert an expression. You could then try something like this to display the page height and then width separated by a comma:
[% @layout_pageheight ||', '|| @layout_pagewidth %]
Note: You can also add a numeric scale by first clicking on the scale icon in the map layout screen,
any changing the style to numeric. This will be dynamic and will change when map scale is changed or map dimensions , and will be in the form you mention above (e.g. 1:5000).
If you want to display page size (e.g. A4)
You will need to write a custom expression similar to this below
[%CASE
WHEN @layout_pagewidth = 297 AND @layout_pageheight = 210 THEN 'A4'
WHEN @layout_pagewidth = xx AND @layout_pageheight = xx THEN 'A3'
ELSE 'Custom'
END%]