【问题标题】:Specify a different inputbin when printing with System.Printing (printQueue.AddJob)使用 System.Printing (printQueue.AddJob) 打印时指定不同的 inputbin
【发布时间】:2016-06-10 16:50:29
【问题描述】:

我正在使用以下代码打印文档:

LocalPrintServer localPrintServer = new LocalPrintServer();
PrintQueue defaultPrintQueue = LocalPrintServer.GetDefaultPrintQueue();

// Call AddJob
PrintSystemJobInfo myPrintJob = defaultPrintQueue.AddJob();

// Write a Byte buffer to the JobStream and close the stream
Stream myStream = myPrintJob.JobStream;
Byte[] myByteBuffer = UnicodeEncoding.Unicode.GetBytes("This is a test string for the print job stream.");
myStream.Write(myByteBuffer, 0, myByteBuffer.Length);
myStream.Close();

我很难将 inputBin 设置为特定的 bin。我已经知道使用它的 bin 是“paper Bin 3”,我的打印机的值为 261。

我知道可以使用这样的 printTicket 更改垃圾箱:

PrintTicket printTicket = defaultPrintQueue.DefaultPrintTicket;
printTicket.InputBin = InputBin.AutoSelect;

问题是枚举 (system.printing.inputBin) ,它只包含标准的最小 bin。 (值从 0 到 5,不包括 bin2、bin3 等。)

问题: - 我怎么想在这种情况下设置纸箱值??? (261) 我知道有办法做到这一点,但几个小时后我仍然坚持这一点。

有什么帮助吗? (注意获取bin名称和对应的值不是我需要的,我只需要弄清楚打印作业票中的值如何设置

请注意,它仅适用于 4.0 项目

谢谢

【问题讨论】:

    标签: c# wpf printing system.printing


    【解决方案1】:

    我使用了这里找到的奇怪方法 (http://www.wittersworld.com/selecting-the-input-tray-when-printing-xps-documents/),它有效。

    【讨论】:

      猜你喜欢
      • 2014-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-29
      • 2013-09-09
      • 1970-01-01
      • 1970-01-01
      • 2022-07-08
      相关资源
      最近更新 更多