The below code is working fine for local printer i.e ("HP LaserJet 1020" -- whichi is installed and connected to my server), but i want to take printout from my network printer i.e ("\\\\ADMIN\HP LaserJet 1020") which is set as a default printer in my server machine.( VS2010, SAP CRYSTAL REPORTS FOR VS2010, ASP.NET, C#)
try
{
ExportOptions CrExportOptions;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = @"D:\\PDF\\" + Regno.ToString() + " (" + Prnt_Id + ")"+".PDF" ;
CrExportOptions = cryPrntRpt.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
cryPrntRpt.Export();
cryPrntRpt.PrintOptions.PrinterName = "HP LaserJet 1020";
cryPrntRpt.PrintToPrinter(1, true, 1, 1);
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert",
"alert('No Printer Selected');", true);
}