I noticed I can add multiple pages to a print composer – cool!
Can I use an expression to set the orientation of specific pages?
(I know a little python so if a function is more appropriate I'd be open to exploring that!)
I have about 5 pages, but need pages 2 and 4 to be landscape, whereas pages 1,3 and 5 should be portrait.
There is a layout_numpages
variable, but that's only for the number of pages, but in the Item properties tab, there is a layout_page
variable under Composer item.
So I tried forcing the orientation with an expression like:
CASE
WHEN @layout_page IN (2,4)
THEN 'landscape'
ELSE 'portrait'
END
But that didn't have any effect. The other thing I can do is rotate all the map elements 90deg, but that's a little more work than just rotating the actual page to match the map elements.
Best Answer
As was answered before, changing page orientation is not enough. You also need to resize and move the map item.
Quoting from cited posts (this was for Atlas Feature but could be adapted)
I know answers providing links are not the best but it has been extensively described on two posts on the blog Gis Unchained.
Multiple format map series using QGIS 2.6 : Part 1 - Part 2