All you need is a default print queue, which you can get through
var pq = LocalPrintServer.GetDefaultPrintQueue()
From this you can create an XpsDocumentWriter :
var writer = PrintQueue.CreateXpsDocumentWriter(pq);
Now you can get the DocumentPaginator from your DocumentViewer using the Document Property , which returns the IDocumentPaginatorSource that has the DocumentPaginator property:
var paginator = documentviewer.Document.DocumentPaginator;
and you can send this right to the XpsDocumentWriter Write method :
writer.Write(paginator);
Simple, right?
Will
source share