【问题标题】:PrintQueue Addjob hang issue in Windows 10Windows 10 中的 PrintQueue Addjob 挂起问题
【发布时间】:2018-11-09 06:45:55
【问题描述】:

我有一个关于打印问题的问题。

我有一个函数调用包含以下代码:

PrintQueue.UserPrintTicket = Ticket;
PrintQueue.AddJob(ShortDocumentName, XpsDocumentFile, false);

Ticket是PrintTicket的类型,ShortDocumentName是doc名称的字符串类型,XpsDocumentFile是xps文件名的字符串类型。

这两行代码在 Windows 7 中运行成功,但在 Windows 10 中会挂起。

这个问题有什么变通或解决方案吗?

【问题讨论】:

  • 我今天使用下面的方法,但在硬打印机上不能正常工作。使用 (var fileStream = new StreamReader(XpsDocumentFile)) 使用 (var printStream = new PrintQueueStream(PrintQueue, ShortDocumentName, true)) { fileStream.BaseStream.CopyTo(printStream); }
  • var file = File.ReadAllBytes(XpsDocumentFile);使用 (var job = PrintQueue.AddJob(ShortDocumentName, Ticket)) 使用 (var stream = job.JobStream) { stream.Write(file, 0, file.Length);我也试过这个方法,它会在 Windows 7 中崩溃。
  • 微软的任何人都可以提供问题的原因吗?

标签: c# windows printing freeze


【解决方案1】:

试试 PrintDialog 怎么样?

PrintQueue.AddJob hangs when printing to non-xps based printers

其实我是想用cmets写的,但是我还没有那个权限。 所以我发布了答案。如果我用错了,我很抱歉。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-20
    • 1970-01-01
    • 2018-03-26
    • 1970-01-01
    • 2021-11-29
    • 1970-01-01
    • 1970-01-01
    • 2015-10-20
    相关资源
    最近更新 更多