WPF Documentviewerbase.Print. Delete dialog box

I am using WPF and DocumentViewer to display a document. However, when I use DocumentViewerBase.Print, it gives a “standard” Windows dialog prompting me to select the printer with the default one already selected. How can I get rid of this? I just want to use a printing method that will automatically start printing without another invitation between them.

+3
source share
1 answer

I believe that for this you will need to write your own printing procedure, for example. by overriding the OnPrintCommand DocumentViewer method. The reason is that the default implementation uses the PrintQueue.CreateXpsDocumentWriter method to create an XpsDocumentWriter object and shows PrintDialog to determine its properties. For more information check out DocumentViewerBase.OnPrintCommand with reflector

+2
source

Source: https://habr.com/ru/post/1728129/


All Articles