Using the Wpf DocumentViewer control I can't figure out how to set the PageOrientation on the PrintDialog that the DocumentViewer displays when the user clicks the print button. Is there a way to hook into this?
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
- How to properly change a resource dictionary
The workaround I used to set the orientation on my DocumentViewer's print dialog was to hide the print button on the DocumentViewer control by omitting the button from the template. I then provided my own print button and tied it to the following code:
Mike's answer works. The way I chose to implement it was to instead create my own doc viewer derived from DocumentViewer. Also, casting the Document property to FixedDocument wasn't working for me - casting to FixedDocumentSequence was.
GetDesiredPageOrientation is whatever you need it to be. In my case, I'm inspecting the first page's dimensions, because I generate documents that are uniform size and orientation for all pages in the document, and with only one doc in the sequence.