Print Access is Denied

I get an Access is Denied message when using the Document.Print(printer name) method. I’m running the program under my own account in debug. I have access to print to the printer outside of this program. I’ve tried printing using 2 seperate printers, one that I can manage and one that I only have print access to and both fail. I’ve tried printing based on the sharename directly and the printer name as seen on my PC. I know it finds the printer as an invalid name provides a different error.
I have no problem loading the word document and manipulating it. I just can’t seem to send it to the printer.
I’m attempting to print a Word Document I’ve loaded and manipulated in memory to a print queue decided at run-time.
I could try switching to the XPSPrint API and seeing if that helps, but I was hoping this would work.
Any suggestions would be appreciated.

Hi

Thank for your inquiry. Please make sure that name of the printer is specified correctly. Make sure that name of the machine or IP address is specified correctly, in case of using of network printer.
On my side I use the following printer name:

PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = @"\\192.168.0.2\hp LaserJet 1010 Series Driver";
doc.Print(printerSettings);

Also, make sure that you have rights to print on this printer. You can try using the following code for testing. This code does not use Aspose.Words at all. So if it will not work, the problem is somewhere on your side.

PrintDocument doc = new PrintDocument();
doc.PrinterSettings.PrinterName = @"\\192.168.0.2\hp LaserJet 1010 Series Driver";
doc.PrintPage += Doc_PrintPage;
doc.Print();
private void Doc_PrintPage(object sender, PrintPageEventArgs e)
{
    e.Graphics.DrawImage(Image.FromFile(@"C:\Temp\test.jpg"), e.MarginBounds.Left, e.MarginBounds.Top);
}

This code just prints an image.
Best regards.

Using your code above I was able to find a printer I could print to. There is apparently something in our network setup that is causing issues. Time to talk to the network techs. Thanks for your time.