I have created a window service that will process reports and then call the PrintToPrinter to print them on a specified printer. The service prints the reports if the service runs on a local machine but it doesn't print the reports when it runs on a window virtual machine. FYI, It doesn't throw any exceptions. I've been searching for reasons/solutions but haven't found anything. Please advise. Below is the code that I use.
public void PrintReports(string printer)
{
try
{
GetReportDocument().PrintOptions.PrinterName = printer;
GetReportDocument().PrintToPrinter(new PrinterSettings { PrinterName = printer }, new PageSettings(), false);
}
catch(Exception e)
{
................
}
}