Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Iam struggling trying to redirect pending printer jobs from a print queue to another printer. I have looked up for a lot of alternatives but I can not seem to find a specific way to do it.

I have also managed to retrieve all the pending jobs but can not seem to find a way to send to another printer.

I found something here to pause the print jobs but I don't want to resume it on the same printer but another one

A Simple Approach for Controlling Print Jobs using WMI[^]

What I have tried:

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

            //Set the correct printer
            pname = this.listBox1.SelectedItem.ToString();
            //Gather print jobs
            GetPrintJobsCollection(defaultprinter); //this is working

            RedirectPrintJobs(pname); //not sure how

            //Cancel old jobs on the old printer 
            CancelPrintJob(defaultprinter); //this is working
Posted
Updated 18-May-19 1:38am
v3
Comments
Hannah Ptr 18-May-19 7:14am    
I also thought of eecuting a batch file to retrieve the file that was sent to the old print and create a new printjob.

1 solution

Probably, you can't: the print data in the queue is specific to the actual printer - if you have two different makes (or even different models or software versions in the same make and model) the data will be meaningless to the printer you redirected it to.
That's what a print driver does: takes your input and formats it for a specific printer using a "manufacturer instruction set" to produce a file which the print spooler (part of Windows and the software that controls each queue) sends to the actual hardware.

You would really need to the redirection before anything gets to the print driver, long before it hits the print queue.
 
Share this answer
 
Comments
Hannah Ptr 18-May-19 9:29am    
I tested this solution on visual studio and it worked when i chose the .spl file from spool folder. But now I am not sure how to convert it to c#. :[

https://www.codeproject.com/KB/printing/EMFSpoolViewer.aspx?msg=3544620

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900