Hey Dominique, thank you, that works very well 🙂 I successfully did it!
I want to use the printer style with legend which I have found in the sample codes. I have two questions here. I attach a screenshot here [ATTACH]6931[/ATTACH]
1. In the map frame, the map has been zoomed in, but in the print page the map doesn't zoom in (stays the Illinois state) leaving only a red rectangle in the northwest part (sorry,,,,it's very small...) as the area that will be printed. I see from your sample, when hitting the toggle button, the print dialog show again with a refreshed scale. In my application, I actually use a button (not a toggle button) to show the print dialog. Is there a way to get a zoomed map in the print dialog?
2. There is a difference between the two legends in the screenshot. I use the 'layerids' to limit the layers displayed in the legend. But I didn't find the similar thing in the legend in the printer style. So in the printer dialog, the legend side display all of the layers in my application. Is there a place in the printer style I can limit the 'layerids'?
Thank you! 😄