【发布时间】:2015-02-12 17:46:24
【问题描述】:
我正在尝试在 WPF 应用程序中打印之前显示一个打印对话框。我正在使用来自 link
的 Microsoft 示例代码// Create the print dialog object and set options
PrintDialog pDialog = new PrintDialog();
pDialog.PageRangeSelection = PageRangeSelection.AllPages;
pDialog.UserPageRangeEnabled = true;
// Display the dialog. This returns true if the user presses the Print button.
Nullable<Boolean> print = pDialog.ShowDialog();
它在最后一行崩溃,但有以下异常:
PrintTicket 提供程序无法绑定到打印机。 Win32 错误: 打印机名称无效。
我尝试搜索解决方案,人们建议的两个解决方案是安装打印机服务器功能,并切换到任何 CPU 构建,但这些都不适用于我的情况。
【问题讨论】:
-
您尝试过的每台打印机都会出现这种情况吗?我遇到了特定于打印机的问题;所以这也是需要注意的事情。
标签: c# wpf winapi printing printdialog