internal static cPrinter getcPrint( PrintDialog printDialog, string deviceName, string driverName, string port, int orientation, int paperSize, int width, int height) { cPrinter o = new cPrinter(printDialog); o.setDeviceName(deviceName); o.setDriverName(driverName); o.setPort(port); cReportPaperInfo paperInfo = o.getPaperInfo(); paperInfo.setOrientation(orientation); paperInfo.setPaperSize((csReportPaperType)paperSize); if (width == 0 || height == 0) { getSizeFromPaperSize((csReportPaperType)paperSize, orientation, out width, out height); } paperInfo.setWidth(width); paperInfo.setHeight(height); return o; }
internal static cPrinter getcPrint( PrintDialog printDialog, string deviceName, string driverName, string port, int orientation, int paperSize, int width, int height) { cPrinter o = new cPrinter(printDialog); o.setDeviceName(deviceName); o.setDriverName(driverName); o.setPort(port); cReportPaperInfo paperInfo = o.getPaperInfo(); paperInfo.setOrientation(orientation); paperInfo.setPaperSize((csReportPaperType)paperSize); if (width == 0 || height == 0) { getSizeFromPaperSize((csReportPaperType)paperSize, orientation, out width, out height); } paperInfo.setWidth(width); paperInfo.setHeight(height); return(o); }
public void setPaperBin(String paperBin) { if (m_printer == null) { return; } if (paperBin.Length == 0) { int idPaperBin = 0; idPaperBin = cPrintAPI.printerPaperBinNameToId(m_printer.getDeviceName(), m_printer.getPort(), paperBin); m_printer.getPaperInfo().setPaperBin(idPaperBin); } }
private bool printPagesToPrinter(cPrinter printer, cIPrintClient objClient) { try { PrintDocument printDoc = new PrintDocument(); cReportPaperInfo w_paperInfo = m_report.getPaperInfo(); if (!printer.starDoc(printDoc, m_report.getName(), w_paperInfo.getPaperSize(), w_paperInfo.getOrientation())) { return false; } printDoc.PrintPage += new PrintPageEventHandler(printPage); printDoc.PrinterSettings.PrinterName = printer.getDeviceName(); //PrintDialog printDialog = new PrintDialog(); //printDialog.Document = printDoc; //DialogResult dialogResult = printDialog.ShowDialog(); //if (dialogResult == DialogResult.OK) //{ m_pageToPrint = -1; m_pagesToPrint = pGetPagesToPrint(printer.getPaperInfo().getPagesToPrint()); m_objClientToPrint = objClient; printDoc.Print(); //} /* for (i = 0; i < m_report.getPages().count(); i++) { if (pHaveToPrintThisPage(i, vPages)) { if (!printer.starPage()) { throw new ReportPaintException(csRptPaintErrors.CSRPT_PAINT_ERR_PRINTING, C_MODULE, "Ocurrio un error al imprimir el reporte." ); } printPage(i, true); if (!drawPage(printer)) { return false; } if (!printer.endPage()) { throw new ReportPaintException(csRptPaintErrors.CSRPT_PAINT_ERR_PRINTING, C_MODULE, "Ocurrio un error al imprimir el reporte." ); } if (!pRefreshObjClient(i, objClient)) { return false; } } } if (!printer.endDoc()) { throw new ReportPaintException(csRptPaintErrors.CSRPT_PAINT_ERR_PRINTING, C_MODULE, "Ocurrio un error al imprimir el reporte." ); } */ return true; } catch (Exception ex) { cError.mngError(ex, "printPagePrinter", C_MODULE, ""); return false; } }