0

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

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。我已经知道使用它的垃圾箱是“纸箱 3”,我的打印机的值为 261。

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

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

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

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

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

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

谢谢

4

1 回答 1

0

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

于 2016-06-10T17:37:55.793 回答