0

I'm printing a document with the following code :

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();

I'm having hard time trying to set the inputBin to a specific bin. I already know the bin to use it's the "paper Bin 3" and the value is 261 for my printer.

I understand that the bin can be changed using a printTicket like this :

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

The problem is the enum (system.printing.inputBin) , it only contain the standard minimal bin. (value from 0 to 5 without bin2, bin3, etc..)

Question : - How i'm suppose the set the paper bin value in this case??? (261) I know there is a way to do it but after many hours i'm still stuck with this.

Any help ? (note that getting the bin name and corresponding value is not what I need, I only need to figure out how to set the value in the print job ticket

Note that it only work with a 4.0 project

Thanks

michelqa
  • 137
  • 1
  • 2
  • 14

1 Answers1

0

I use the strange method found here (http://www.wittersworld.com/selecting-the-input-tray-when-printing-xps-documents/) and it work.

michelqa
  • 137
  • 1
  • 2
  • 14