We’re just finishing up a new release for our weather station software, and thought it might be nice to add printing for our users.
The printouts lend themselves to Landscape orientation, but much as we searched, we couldn’t find a way to get the DocumentViewer control to show us the preview in Landscape mode.
In the end, there are a sequence of things that need to be done.
First, when you create your PrintDialog, make sure you set the PageOrientation property to PageOrientation.Landscape. That in itself isn’t enough though.
So, now store the size of the paper from the successful print dialog, and construct your DocumentPaginator object.
Where uc some control or Framework Element.
And here’s the important bit. When you return a DocumentPage, make sure you use the overload that takes the PageSize you calculated above. If you do, then preview works great.
I had naively assumed that overriding the PageSize abstract property would do this job, but it did not.