PrintQueueWatch Job.Transfer

Aug 9 2024 5:06 AM

Anybody has use the PrintQueueWatch dll for monitor printJobs and printers.

I'm using the PrintQueueWatch dll for a simple app to monitor printers.

I wanna know how to use the function

PrintJob.Transfer.(string printerName, bool transfer)

The function is for transfer the print job to another printer, It's seems very easy to use, the function needs the printer name and a bool value to keep or not the print job in the original printer

but the problem is that always raises an exception

access denied

I've done all this steps that a user  here told me to do,but still the same

Printer Permissions: Ensure that your application has the necessary permissions to manage the printers and print jobs. This includes:

    Read/Write permissions on both the source and destination printers.
    Manage Documents permission for both printers.

Run as Administrator: Run your application with elevated privileges (Run as Administrator) to ensure it has the necessary access rights.

Check Printer Spooler Service: Ensure that the Printer Spooler service is running and that there are no issues with it. Restarting the spooler service might help.

User Account Control (UAC): If UAC is enabled, it might be blocking access. Try running the application with UAC disabled or adjust the UAC settings.

This is what I'm  doing.

using (PrinterQueueWatch.PrinterInformation PrinterInfo = new PrinterQueueWatch.PrinterInformation("HP LaserJet P1006", PrinterQueueWatch.SpoolerApiConstantEnumerations.PrinterAccessRights.SERVER_ALL_ACCESS, true))
                {                    
                    PrinterInfo.PrintJobs.get_ItemByJobId(Id).Transfer("Microsoft Print to PDF", false);                    
                }

Thanks

 

 

 


Answers (1)