public void Easy_Print(String printName, PaperKind paperKind, Boolean isHorizon, Boolean isShowPrintDlg) { PrinterSettings printerSettings = new PrinterSettings(); PageSettings pageSetting; if (printName != null && printName.Equals("") == false) { printerSettings.PrinterName = printName; pageSetting = new PageSettings(printerSettings); } else { pageSetting = new PageSettings(); } PaperSize paperSize = new PaperSize(); paperSize.PaperName = paperKind.ToString(); paperSize.RawKind = (int)paperKind; pageSetting.PaperSize = paperSize; pageSetting.Landscape = isHorizon; if (isShowPrintDlg) { /* * SetPageSettings(pageSetting); * if (printName != null && printName.Equals("") == false) PrintDialog(PrinterSettings); * else */ _rv.PrintDialog(); } else { try { _reportPrintDoc = new ReportPrintDocument(_rv.LocalReport); _reportPrintDoc.DefaultPageSettings = pageSetting; _reportPrintDoc.Print(); } catch { try { _rv.PrintDialog(); } catch (Exception e) { MessageBox.Show("프린트시 에러발생.." + e.ToString()); } } } }
public void Easy_Print(String printName, PaperKind paperKind, Boolean isHorizon = false, Boolean isShowPrintDlg = false) { PrinterSettings printerSettings = new PrinterSettings(); PageSettings pageSetting; if (printName != null && printName.Equals("") == false) { printerSettings.PrinterName = printName; pageSetting = new PageSettings(printerSettings); } else { pageSetting = new PageSettings(); } PaperSize paperSize = new PaperSize(); paperSize.PaperName = paperKind.ToString(); paperSize.RawKind = (int)paperKind; pageSetting.PaperSize = paperSize; pageSetting.Landscape = isHorizon; if (isShowPrintDlg) { SetPageSettings(pageSetting); if (printName != null && printName.Equals("") == false) { PrintDialog(PrinterSettings); } else { PrintDialog(); } } else { _reportPrintDoc = new ReportPrintDocument(this.LocalReport); _reportPrintDoc.DefaultPageSettings = pageSetting; _reportPrintDoc.Print(); } }