I am trying to print an existing XPS file in GrayScale . I tried to add a PrintTicket inside the XPS file, and also tried to change the PrintQueue property of the printer , like :
LocalPrintServer server = new LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer);
PrintQueue pq = server.GetPrintQueue("MyPrinterName");
pq.DefaultPrintTicket.OutputColor = OutputColor.Grayscale;
PrintSystemJobInfo print = pq.AddJob("myPrintJob", "MyFileToPrint.xps",false);
But still printing the file in colors ...
So , I thinking about changing the print setting in the driver settings itself , like :
So , Is it possible to change this option programmatically ??
Changing global state to solve a local problem is usually a bad idea. Submitting a print ticket with the job should allow the sort of control you are looking for. Have you tried something like this?
LocalPrintServer server = new LocalPrintServer(PrintSystemDesiredAccess.AdministrateServer);
PrintQueue pq = server.GetPrintQueue("MyPrinterName");
var jobTicket = pq.DefaultPrintTicket;
jobTicket.OutputColor = OutputColor.Grayscale;
PrintSystemJobInfo print = pq.AddJob("myPrintJob", "MyFileToPrint.xps", false, jobTicket);