I’ve using the WPF DocumentViewer control to display an XPS Document like so:
viewer.Document = xpsDocument.GetFixedDocumentSequence();
When the print button inside the document viewer is clicked everything prints okay, however the name of the print job is System.Windows.Documents.FixedDocumentSequence, which is less than ideal.
How do I set the name of the print job?
I know using PrintDialog.PrintDocument() lets me set the name, but I can’t see how to do it using the DocumentViewer control.
I found a solution.
Add this to the XAML
And this to the code behind
A couple of things of note. The PreviewExecuted method doesn’t happen if the Exectued event isn’t bound to. Don’t know why.