【问题标题】:Microsoft XPS Document writer v4Microsoft XPS 文档编写器 v4
【发布时间】:2018-05-02 17:44:08
【问题描述】:

在 Windows 10 中使用 Microsoft XPS Document Writer 将 PrintDocument 打印到文件总是抛出异常“句柄无效”。但在 Windows 7 中它运行良好。

PrinterSettings 更改为自定义页面大小时引发错误。在不更改 PrinterSettings 的情况下打印时不会出错。

谁能解释如何在 Windows 10 中执行的 C# Windows 窗体应用程序中解决此问题?

【问题讨论】:

  • 请出示您的代码。我们需要能够复制问题。

标签: c# windows-10-desktop xpsdocument


【解决方案1】:

很抱歉给我带来了麻烦。 该错误与计算页面高度和宽度时的小错误有关。我传递的值略低于实际的页面高度和宽度。

结论
在 Windows 7 中,页面设置的微小变化不会影响实际打印,但在 Windows 10 和 Windows Server 2012 中,页面设置必须准确。

【讨论】:

    猜你喜欢
    • 2011-06-29
    • 2016-05-30
    • 2012-02-29
    • 2010-10-23
    • 2021-01-02
    • 2016-03-17
    • 1970-01-01
    • 2012-10-15
    • 2011-11-30
    相关资源
    最近更新 更多