none
Imprimir de ticketera EPSON en Windows 10 con Visual Basic 2019 C# RRS feed

  • Pregunta

  • Buenos días amigos, tengo un problema el cual es que en mi programa hecho con C# en Visual 2019 Community imprime con normalidad en el Windows7 pero cuando se paso al Windows10 este imprime el ticket pero con diferente letra (no reconoce la letra que le mando desde el programa), se ha cambiado el tamaño, el tipo de fuente pero la ticketra sigue enviando su propio tipo de letra y su propio tamaño, por favor ayudenme con este inconveniente les dejo el codigo:

    PrintDialog pd = new PrintDialog();
    pd.PrintQueue = new PrintQueue(new PrintServer(), "EPSON TM-U220 Receipt");
    
     /*CUERPO TICKET*/
                    Grid gd = new Grid();
                    gd.Width = 300;
                    int nPO_VERT = 12;
    
                    Label lbl = new Label();
                    lbl.Margin = new Thickness(0, 0, 0, 0);
                    lbl.Content = sDE_DIRE_WEBS.ToLower();
                    lbl.FontSize = 11.5;
                    lbl.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
    
                    Label lbl1 = new Label();
                    lbl1.Margin = new Thickness(0, 12, 0, 0);
                    lbl1.Content = sDE_NOMB;
                    lbl1.FontSize = 9;
                    lbl1.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl1.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
    
                    Label lbl2 = new Label();
                    lbl2.Margin = new Thickness(0, 24, 0, 0);
                    lbl2.Content = "RUC " + sNU_RUCS;
                    lbl2.FontSize = 11.5;
                    lbl2.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl2.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
    
                    string sVU_OPER = "";
    
                    if (sID_MOVI_OPER != "")
                        sVU_OPER = "(" + sNU_VUEL + "/" + sNU_TOTA_VUEL + ")";
    
                    Label lbl3 = new Label();
                    lbl3.Margin = new Thickness(0, 36, 0, 0);
                    lbl3.Content = "PESAJE BALANZA-" + sNU_MOVI;
                    lbl3.FontSize = 11.5;
                    lbl3.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl3.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
    
                    Label lbl26 = new Label();
                    lbl26.Margin = new Thickness(0, 48, 40, 0);
                    lbl26.Content = sVU_OPER;
                    lbl26.FontSize = 11.5;
                    lbl26.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl26.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
    
                    nPO_VERT = 48;
    
                    Label lbl4 = new Label();
                    string[] aDE_NAVE = fn_RECO_TEXT(sNU_RECA + "-" + sNO_NAVE).Split(';');
                    if (aDE_NAVE.Length > 0)
                    {
                        for (int nNU_INDI = 0; nNU_INDI < aDE_NAVE.Length; nNU_INDI++)
                        {
                            if (nNU_INDI == 0)
                            {
                                nPO_VERT += 12;
                                lbl4.Margin = new Thickness(15, nPO_VERT, 0, 0);
                                lbl4.Content = "Nave     : " + aDE_NAVE[nNU_INDI];
                                lbl4.FontSize = 11.5;
                                lbl4.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                                lbl4.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                            }
                            else
                            {
                                nPO_VERT += 12;
                                lbl4.Content += "\n" + ("           " + aDE_NAVE[nNU_INDI]);
                            }
                        }
                    }
                    else
                    {
                        nPO_VERT += 12;
                        lbl4.Margin = new Thickness(15, nPO_VERT, 0, 0);
                        lbl4.Content = "Nave     : " + sNU_RECA + "-" + sNO_NAVE;
                        lbl4.FontSize = 11.5;
                        lbl4.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                        lbl4.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    }
    
                    Label lbl5 = new Label();
                    string[] aDE_CLIE = fn_RECO_TEXT(sDE_CLIE).Split(';');
                    if (aDE_CLIE.Length > 0)
                    {
                        for (int nNU_INDI = 0; nNU_INDI < aDE_CLIE.Length; nNU_INDI++)
                        {
                            if (nNU_INDI == 0)
                            {
                                nPO_VERT += 15;
                                lbl5.Margin = new Thickness(15, nPO_VERT, 0, 0);
                                lbl5.Content = "Cliente  : " + aDE_CLIE[nNU_INDI];
                                lbl5.FontSize = 11.5;
                                lbl5.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                                lbl5.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                            }
                            else
                            {
                                nPO_VERT += 15;
                                lbl5.Content += "\n" + ("           " + aDE_CLIE[nNU_INDI]);
                            }
                        }
                    }
                    else
                    {
                        nPO_VERT += 15;
                        lbl5.Margin = new Thickness(15, nPO_VERT, 0, 0);
                        lbl5.Content = "Cliente  : " + sDE_CLIE;
                        lbl5.FontSize = 11.5;
                        lbl5.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                        lbl5.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    }
    
                    nPO_VERT += 15;
                    Label lbl6 = new Label();
                    lbl6.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl6.Content = "BL/NE    : " + sNU_DOCU_ORIG;
                    lbl6.FontSize = 11.5;
                    lbl6.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl6.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl7 = new Label();
                    lbl7.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl7.Content = "Item BL  : " + sNU_SECU_ITEM;
                    lbl7.FontSize = 11.5;
                    lbl7.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl7.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    Label lbl8 = new Label();
                    string[] aDE_PROD = fn_RECO_TEXT(sDE_PROD).Split(';');
                    if (aDE_PROD.Length > 0)
                    {
                        for (int nNU_INDI = 0; nNU_INDI < aDE_PROD.Length; nNU_INDI++)
                        {
                            if (nNU_INDI == 0)
                            {
                                nPO_VERT += 12;
                                lbl8.Margin = new Thickness(15, nPO_VERT, 0, 0);
                                lbl8.Content = "Producto : " + aDE_PROD[nNU_INDI];
                                lbl8.FontSize = 11.5;
                                lbl8.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                                lbl8.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                            }
                            else
                            {
                                nPO_VERT += 12;
                                lbl8.Content += "\n" + ("           " + aDE_PROD[nNU_INDI]);
                            }
                        }
                    }
                    else
                    {
                        nPO_VERT += 12;
                        lbl8.Margin = new Thickness(15, nPO_VERT, 0, 0);
                        lbl8.Content = "Producto : " + sDE_PROD;
                        lbl8.FontSize = 11.5;
                        lbl8.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                        lbl8.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    }
    
                    nPO_VERT += 15;
                    Label lbl9 = new Label();
                    lbl9.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl9.Content = "Producto  : " + sDE_PERM;
                    lbl9.FontSize = 11.5;
                    lbl9.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl9.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    Label lbl10 = new Label();
                    string[] aDE_REGI = fn_RECO_TEXT(sDE_REGI).Split(';');
                    if (aDE_REGI.Length > 0)
                    {
                        for (int nNU_INDI = 0; nNU_INDI < aDE_REGI.Length; nNU_INDI++)
                        {
                            if (nNU_INDI == 0)
                            {
                                nPO_VERT += 12;
                                lbl10.Margin = new Thickness(15, nPO_VERT, 0, 0);
                                lbl10.Content = "Régimen  : " + aDE_REGI[nNU_INDI];
                                lbl10.FontSize = 11.5;
                                lbl10.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                                lbl10.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                            }
                            else
                            {
                                nPO_VERT += 12;
                                lbl10.Content += "\n" + ("           " + aDE_REGI[nNU_INDI]);
                            }
                        }
                    }
                    else
                    {
                        nPO_VERT += 12;
                        lbl10.Margin = new Thickness(15, nPO_VERT, 0, 0);
                        lbl10.Content = "Régimen  : " + sDE_REGI;
                        lbl10.FontSize = 11.5;
                        lbl10.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                        lbl10.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    }
    
                    Label lbl11 = new Label();
                    string[] aDE_TRAN = fn_RECO_TEXT(sNO_TRAN).Split(';');
                    if (aDE_TRAN.Length > 0)
                    {
                        for (int nNU_INDI = 0; nNU_INDI < aDE_TRAN.Length; nNU_INDI++)
                        {
                            if (nNU_INDI == 0)
                            {
                                nPO_VERT += 24;
                                lbl11.Margin = new Thickness(15, nPO_VERT, 0, 0);
                                lbl11.Content = "Transp.  : " + aDE_TRAN[nNU_INDI];
                                lbl11.FontSize = 11.5;
                                lbl11.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                                lbl11.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                            }
                            else
                            {
                                nPO_VERT += 12;
                                lbl11.Content += "\n" + ("           " + aDE_TRAN[nNU_INDI]);
                            }
                        }
                    }
                    else
                    {
                        nPO_VERT += 24;
                        lbl11.Margin = new Thickness(15, nPO_VERT, 0, 0);
                        lbl11.Content = "Transp.  : " + sNO_TRAN;
                        lbl11.FontSize = 11.5;
                        lbl11.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                        lbl11.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    }
    
                    nPO_VERT += 15;
                    Label lbl12 = new Label();
                    lbl12.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl12.Content = "RUC      : " + sNU_RUCC;
                    lbl12.FontSize = 11.5;
                    lbl12.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl12.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl13 = new Label();
                    lbl13.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl13.Content = "Vehículo : " + sNU_PLAC;
                    lbl13.FontSize = 11.5;
                    lbl13.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl13.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl23 = new Label();
                    lbl23.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl23.Content = "Carreta  : " + sDE_NUME_TRAC;
                    lbl23.FontSize = 11.5;
                    lbl23.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl23.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl24 = new Label();
                    lbl24.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl24.Content = "MIC      : " + sDE_MICS;
                    lbl24.FontSize = 11.5;
                    lbl24.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl24.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    Label lbl27 = new Label();
                    if (sST_CARG_CONT == "S")
                    {
                        nPO_VERT += 12;
                        lbl27.Margin = new Thickness(15, nPO_VERT, 0, 0);
                        lbl27.Content = "Contenedor : " + sDE_CONT;
                        lbl27.FontSize = 11.5;
                        lbl27.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                        lbl27.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    }
    
                    nPO_VERT += 24;
                    Label lbl14 = new Label();
                    lbl14.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl14.Content = "Ingreso  : " + sFE_ENTR.Substring(0, 10) + " " + sHO_ENTR;
                    lbl14.FontSize = 11.5;
                    lbl14.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl14.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl15 = new Label();
                    lbl15.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    if (sFE_SALI != "" && sHO_SALI != "")
                    {
                        lbl15.Content = "Salida   : " + sFE_SALI.Substring(0, 10) + " " + sHO_SALI;
                    }
                    else
                    {
                        lbl15.Content = "Salida   : " + "";
                    }
                    lbl15.FontSize = 11.5;
                    lbl15.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl15.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    Label lbl16 = new Label();
    
                    nPO_VERT += 12;
                    lbl16.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    if (sDE_BULT != "")
                        lbl16.Content = "Bultos   : " + sDE_BULT + " " + sDE_EMBA;
                    else
                        lbl16.Content = "Bultos   : " + sDE_EMBA;
                    lbl16.FontSize = 11.5;
                    lbl16.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl16.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
    
                    nPO_VERT += 12;
                    Label lbl17 = new Label();
                    lbl17.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl17.Content = "1er Peso : " + sCA_PES1 + " (KG)";
                    lbl17.FontSize = 11.5;
                    lbl17.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl17.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl18 = new Label();
                    lbl18.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl18.Content = "2do Peso : " + sCA_PES2 + " (KG)";
                    lbl18.FontSize = 11.5;
                    lbl18.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl18.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl19 = new Label();
                    lbl19.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl19.Content = "P. NETO  : " + sPE_NETO + " (KG)";
                    lbl19.FontSize = 11.5;
                    lbl19.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl19.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl25 = new Label();
                    lbl25.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl25.Content = "Nro. Ejes  : " + (sNU_EJES == "" ? "0" : sNU_EJES);
                    lbl25.FontSize = 11.5;
                    lbl25.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl25.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 24;
                    Label lbl20 = new Label();
                    lbl20.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl20.Content = "Balanza  : " + sDE_TIPO;
                    lbl20.FontSize = 11.5;
                    lbl20.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl20.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 12;
                    Label lbl21 = new Label();
                    lbl21.Margin = new Thickness(15, nPO_VERT, 0, 0);
                    lbl21.Content = "Usuario  : " + sDE_PERS_PES2;
                    lbl21.FontSize = 11.5;
                    lbl21.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl21.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
    
                    nPO_VERT += 24;
                    Label lbl22 = new Label();
                    lbl22.Margin = new Thickness(0, nPO_VERT, 0, 0);
                    lbl22.Content = "MANEJE CON CUIDADO";
                    lbl22.FontSize = 11.5;
                    lbl22.FontFamily = new System.Windows.Media.FontFamily("Courier New");
                    lbl22.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
    
                    gd.Children.Add(lbl);
                    gd.Children.Add(lbl1);
                    gd.Children.Add(lbl2);
                    gd.Children.Add(lbl3);
                    gd.Children.Add(lbl26);
                    gd.Children.Add(lbl4);
                    gd.Children.Add(lbl5);
                    gd.Children.Add(lbl6);
                    gd.Children.Add(lbl7);
                    gd.Children.Add(lbl8);
                    gd.Children.Add(lbl9);
                    gd.Children.Add(lbl10);
                    gd.Children.Add(lbl11);
                    gd.Children.Add(lbl12);
                    gd.Children.Add(lbl13);
                    gd.Children.Add(lbl23);
                    gd.Children.Add(lbl24);
                    gd.Children.Add(lbl27);
                    gd.Children.Add(lbl14);
                    gd.Children.Add(lbl15);
                    gd.Children.Add(lbl16);
                    gd.Children.Add(lbl17);
                    gd.Children.Add(lbl18);
                    gd.Children.Add(lbl19);
                    gd.Children.Add(lbl25);
                    gd.Children.Add(lbl20);
                    gd.Children.Add(lbl21);
                    gd.Children.Add(lbl22);
    
                    Paragraph parrafo = new Paragraph();
                    parrafo.Inlines.Add(gd);
                    FlowDocument doc = new FlowDocument(parrafo);
                    doc.PageWidth = 325;
    
                    doc.FontSize = 8.5;
                    pd.PrintDocument(((IDocumentPaginatorSource)doc).DocumentPaginator, "TICKET DE MOVIMIENTO BALANZA");
    Por favor si pudieran ayudarme se los agradecería mucho.


    jueves, 28 de noviembre de 2019 14:28

Respuestas

Todas las respuestas

  • hola

    Puede que la fuente en cada sistema operativo se implemente diferente

    Si abres un word en Win7 y otro en Win10, puede ver que la fuente Courier New

    se visualiza de la misma forma ?

    saludos


    Leandro Tuttini

    Blog
    MVP Profile
    Buenos Aires
    Argentina

    jueves, 28 de noviembre de 2019 17:23
  • Hola Leandro, 

    Si son las fuentes efectivamente, primero cambie mis fuentes del windows 7 al Windows 10 quitando solo la fuente Courier New y comenzo a imprimir la ticketera, pero otro detalle fue que en un par de horas y por error abri mi proyecto de Visual Studio(VS) 2015 en el VS 2019 y cuando probe el ticket salia mejor incluso que la anterior version, asi que lo que hice fue borrar mi fuente y dejarla con la del vindows 10 y luego imprimi y salio muy bien, por lo que mi duda es la siguiente:

    - Al momento de migrar del VS 2015 al VS 2019 se pudieron haber actualizado las librerias del system? System.Windows.Controls y using System.Printing; bueno la verdad aun no puedo confirmar eso.

    Pero lo que si puedo decir es que ya funcionan las ticketeras en el windows 10 con la version del VS 2019 espero eso pueda ayudar a quienes pasan por el mismo problema. Como indico no deberia darse el caso por el cambio de version pero en esta oportunidad fue de esta manera.

    Saludos

    Juan Andres 

    viernes, 29 de noviembre de 2019 13:30