This is my configuration to print my report:
System.Drawing.Printing.PrinterSettings printersettings = new System.Drawing.Printing.PrinterSettings();
printersettings.PrinterName = Printer;
printersettings.Copies = 1;
printersettings.Collate = false;
reporte.Load(Server.MapPath("~/Report/Client/CustomInfo.rpt"));
reporte.SetDataSource(ds);
reporte.PrintToPrinter(printersettings, new System.Drawing.Printing.PageSettings(), false);
The print name is correct at this point. (Debugging proved the name is correct and the document has the correct path.) But I still getting this error:
Settings to access printer 'Xeroxprinteroffice' are not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Drawing.Printing.InvalidPrinterException: Settings to access printer 'XeroxPrinterOffice' are not valid.
This occurs in line: reporte.PrintToPrinter(printersettings, new System.Drawing.Printing.PageSettings(), false);
How can I resolve this?