拦截 PrintDialog 到 XPS Document Writer
目前我为用户提供两个控件:保存和打印。当用户选择“保存”时,WPF 显示的一个区域将被打包并通过 XpsDocumentWriter 发送,并且提示并鼓励用户签署新的 xps 文档。当用户选择“打印”时,PrintDialog.PrintVisual 会将同一区域打印到用户选择的打印机。
一切都很好,只是 Microsoft XPS Document Writer 是打印机的选择之一。有没有办法阻止或拦截用户对 XPS 文档编写器的选择并将其发送到 Save 方法,以便我可以提示用户签署 XPS 文档?
Currently I am providing the user with two controls: Save and Print. When the user selects Save, a region of the WPF display is packaged up and sent through a XpsDocumentWriter and the user is prompted and encouraged to sign the new xps document. When the user selects Print, a PrintDialog.PrintVisual prints that same region to a user selected printer.
All well and good, except that Microsoft XPS Document Writer is one of the choices for printers. Is there a way to prevent or intercept the user selection of XPS document writer and send them to the Save method so I can prompt the user to sign the xps document?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
免责声明:我以前从未使用过
PrintDialog
,但看起来像这样的东西可能会起作用:我真的不喜欢将打印机名称硬编码(我假设它随语言设置而变化)。可能有更好的属性
PrintQueue
您可以使用它来识别这台打印机。Disclaimer: I've never used
PrintDialog
before, but it looks like something like this might work:I don't really like having the printer name hard-coded (I assume it varies with language settings). Possibly there is a better property of
PrintQueue
that you can use to identify this printer.