예제 #1
0
        public void GetWebPrintJob()
        {
            try
            {
                //Create a WebPrintJob obj
                WebPrintJob webPj = new WebPrintJob();

                //set a ThermalLabel obj
                webPj.ThermalLabel = GenerateBasicThermalLabel();

                //display print dialog to the client
                webPj.ShowPrintDialog = true;

                //set http response data
                //Serialize WebPrintJob and send it back to the client
                //so it can be processed by the TLClientPrint utility
                _ctx.Response.ContentType = "text/plain";
                _ctx.Response.Body.Write(Encoding.UTF8.GetBytes(webPj.ToString()));
            }
            catch (Exception ex)
            {
                _ctx.Response.StatusCode  = 400;
                _ctx.Response.ContentType = "text/plain";
                _ctx.Response.Body.Write(Encoding.UTF8.GetBytes(ex.Message)); //await _ctx.Response.WriteAsync(ex.Message);
            }
        }
예제 #2
0
        public async Task GetWebPrintJob(HttpContext context)
        {
            try
            {
                //Create a WebPrintJob obj
                WebPrintJob webPj = new WebPrintJob();

                //set a ThermalLabel obj
                webPj.ThermalLabel = GenerateBasicThermalLabel();

                //display print dialog to the client
                webPj.ShowPrintDialog = true;

                //set http response data
                //Serialize WebPrintJob and send it back to the client
                //so it can be processed by the TLClientPrint utility
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync(webPj.ToString());
            }
            catch (Exception ex)
            {
                context.Response.StatusCode  = 400;
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync(ex.Message);
            }
        }
    public void Index()
    {
        //Create a WebPrintJob obj
        WebPrintJob webPj = new WebPrintJob();

        //set a ThermalLabel obj
        webPj.ThermalLabel = GenerateBasicThermalLabel();

        //display print dialog to the client
        webPj.ShowPrintDialog = true;

        //Serialize WebPrintJob and send it back to the client
        //so it can be processed by the TLClientPrint utility
        HttpContext.Response.ContentType = "text/plain";
        HttpContext.Response.Write(webPj.ToString());
        HttpContext.Response.Flush();
        HttpContext.Response.End();
    }
예제 #4
0
    public void Index(int?orderId = 0)
    {
        //Create a WebPrintJob obj
        WebPrintJob webPj = new WebPrintJob();

        //Get Invoice Model as per order id and
        //pass it To GenerateBasicThermalLabel(model);

        //set a ThermalLabel obj
        webPj.ThermalLabel = GenerateBasicThermalLabel();

        //display print dialog to the client
        webPj.ShowPrintDialog = false;

        //Serialize WebPrintJob and send it back to the client
        //so it can be processed by the TLClientPrint utility
        HttpContext.Response.ContentType = "text/plain";
        HttpContext.Response.Write(webPj.ToString());
        HttpContext.Response.Flush();
        HttpContext.Response.End();
    }