I'm creating a RDLC report and printing it from ASP.Net. When i try this in local machine it works fine. But when deploying in the server the printer settings are not valid.
//Code
if (m_streams == null || m_streams.Count == 0)
throw new Exception("Error: no stream to print.");
PrintDocument printDoc = new PrintDocument();
// printDoc.PrinterSettings.PrinterName = "HP LaserJet 3055 PCL5";
if (!printDoc.PrinterSettings.IsValid)
{
throw new Exception("Error: cannot find the default printer.");
}
else
{
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
m_currentPageIndex = 0;
printDoc.Print();
}
From the above code it throws me an exception "cannot find default printer". Tried to add the printer name which exists in the client machine but still didn't work.
I need to print the report in the client machine.
Don't know where to change. Any help?