开发者

WPF Documentviewerbase.Print. Remove dialog box

I am using WPF and the DocumentViewer to display a document. However, when I use DocumentViewerBase.Print, it gives the "standard" Windows dialog box asking me to choose a printer with the default already selected. How can I get rid of this? I just want to use a开发者_开发知识库 Print method that will automatically start printing with no other prompt in between.


I believe in order to do this you would need to write your own printing routine e.g. by overriding OnPrintCommand method of the DocumentViewer. The reason is that default implementation is using PrintQueue.CreateXpsDocumentWriter method to create XpsDocumentWriter object and shows a PrintDialog in order to define its properties. For more details check the DocumentViewerBase.OnPrintCommand with reflector

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜