/// <summary> /// Establece la configuracion de la impresora /// </summary> private void SetPrinterConfig() { try { PrinterConfigRequest printerConfigRequest = new PrinterConfigRequest(); printerConfigRequest.CodigoCaja = this.token.CodeBox; printerConfigRequest.CodigoTienda = this.token.CodeStore; PrinterConfigResponse printerConfigResponse = repository.getPrinterConfig(printerConfigRequest); //Configuracion de la impresora PrinterSettings ps = new PrinterSettings(); PrinterName = printerConfigResponse.NombreImpresora; ps.PrinterName = printerConfigResponse.NombreImpresora; // IEnumerable<PaperSize> paperSizes = ps.PaperSizes.Cast<PaperSize>(); // PaperSize sizeA4 = paperSizes.First<PaperSize>(size => size.Kind == PaperKind.Letter); // this.printDocument.DefaultPageSettings.PaperSize = sizeA4; this.printDocument.PrinterSettings = ps; this.printDocument.PrintPage += new PrintPageEventHandler(this.printDocument1_PrintPage); } catch (Exception exception) { TryCatchBusinessExecutor tryCatch = new TryCatchBusinessExecutor(); tryCatch.AddErrorLog <OperationResponse>(exception.Message, exception.StackTrace, "Negocio", exception.ToString(), "Error de impresión"); } }
/// <summary> /// Establece la configuracion de la impresora /// </summary> private void SetPrinterConfig() { PrinterConfigRequest printerConfigRequest = new PrinterConfigRequest(); printerConfigRequest.CodigoCaja = this.token.CodeBox; printerConfigRequest.CodigoTienda = this.token.CodeStore; this.printerConfigResponse = printTicketRepository.getPrinterConfig(printerConfigRequest); this.PrinterName = this.printerConfigResponse.NombreImpresora; }
/// <summary> /// Establece la configuracion de la impresora /// </summary> private void SetPrinterConfig() { PrinterConfigRequest printerConfigRequest = new PrinterConfigRequest(); printerConfigRequest.CodigoCaja = this.token.CodeBox; printerConfigRequest.CodigoTienda = this.token.CodeStore; this.printerConfigResponse = repository.getPrinterConfig(printerConfigRequest); this.PrinterName = this.printerConfigResponse.NombreImpresora; printDocument.PrinterSettings.PrinterName = this.PrinterName; this.drawFont = new Font("Courier New", 8); this.drawBrush = new SolidBrush(System.Drawing.Color.Black); this.pos = new System.Drawing.Point(10, 10); printDocument.PrintPage += new PrintPageEventHandler(this.pd_PrintPage); }
/// <summary> /// Trae la configuracion de la impresora /// </summary> /// <param name="printerConfigRequest"></param> /// <returns></returns> public PrinterConfigResponse getPrinterConfig(PrinterConfigRequest printerConfigRequest) { PrinterConfigResponse printerConfigResponse = new PrinterConfigResponse(); var parameters = new Dictionary <string, object>(); parameters.Add("@CodigoCaja", printerConfigRequest.CodigoCaja); parameters.Add("@CodigoTienda", printerConfigRequest.CodigoTienda); foreach (var c in data.GetDataReader("dbo.sp_vanti_ObtenerConfigImpresoraReportes", parameters)) { printerConfigResponse.NombreImpresora = c.GetValue(0).ToString(); } return(printerConfigResponse); }