protected void BtnApprove_Click(object sender, EventArgs e) { ReportDocument cryPrntRpt; cryPrntRpt = new ReportDocument(); cryPrntRpt.Load(Server.MapPath("~\\CrReports\\CrPrintReport.rpt")); cryPrntRpt.SetDatabaseLogon("UNM", "PWD", @"SRVNM", "MYDB"); cryPrntRpt.PrintToPrinter(1, false, 0, 0); try { ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions(); cryPrntRpt.PrintToPrinter(1, false, 0, 0); CrDiskFileDestinationOptions.DiskFileName = "D:\\PDF\\" + Regno.ToString() + ".PDF"; CrExportOptions = cryPrntRpt.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cryPrntRpt.Export(); } catch (Exception ex) { //Message(ex.ToString()); } con.Close(); }
PrintToPrinter
printDocument.PrinterSettings.PrinterName
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)