How to ues the printJob.Transfer(newPrinter,false) function?

Dec 23, 2011 at 6:32 AM


       I use the printJob.Transfer(@"\\IP\newprinter,false) function to send a printjob to a new printer ,but i get a Win32Exception error. invalid Printer Name

Following is my code,

  private void pmc_JobWritten(Object sender, PrintJobEventArgs args)
            Console.WriteLine("delegate PrintJobEventHandler pmc_JobWritten");
            PrintJob printJob = args.PrintJob;
            Console.WriteLine("isSpooling : "+printJob.Spooling);
            Console.WriteLine("Transfer this PrintJob to new Printer now");
                Console.WriteLine("Transfer this PrintJob to new Printer Successfully");
            }catch(Exception e){
            Console.WriteLine(" End delegate PrintJobEventHandler pmc_JobWritten");



Jan 4, 2012 at 12:52 PM

In the source code for Transfer it says:


'TODO: Transfer fails to open the print job consistently - this will need to be

raised as an MS support incident before this can be achieved


That said, behind the scenes it uses the API call OpenPrinter - on both the source printer and the target printer.  It seems likely that it is objecting to the target printer name (\\IP\newprinter) - maybe try monitoring that printer to see if you have access rights?

The name it uses in getting the source print job is "PrinterName, Job xxxx" - I suppose if the job id is wrong (?) it would also give that error.  You will need to trace through the Transfer code to see what particular line is throwing the error.