4 Replies Latest reply on Jul 5, 2012 9:43 AM by Rakesh Sahu

    How to print Barcode from MC9190-G (C#)

      Dear all,

       

      I want to know how i can Print a Bracode in my Sales slip.

      i want to print a barcode combination of current date-time + auto-number.

       

      i have a MC9190-G device, want to scan a Item at store then add some quantity then click on print button and take print out from Epson Thermal Printer or any kind of Thermal Printer ?

       

      im using .NET 3.5 ( VS 2008)

      using Webservices(.ASMX) to connect Server ( .DBF file) not using MSSQL

       

      So far i Install Epson Thermal printer in my pc, added PrintLib.dll at my Web-services Project.

       

      Thank you all very much.

       

      with regards

      Rakesh

      Rakesh.bits@gmail.com

        • Re: How to print Barcode from MC9190-G (C#)
          vince dibernardo

          I'm purely java but I've played a little in MS tech.  This example below is a server side print example that will print submitted form data  to a printer ("CutePDF Writer") attached to the server using a barcode font (("Free 3 of 9") also installed on the sever.  I can't recall the site where I got the original code from.  Output from CutePDF attached.

           

          Default.aspx

          <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ServerPrintExample._Default" %>

          <html><head id="Head1" runat="server"><title></title></head>

          <body>

              <form id="form1" runat="server">

              <asp:Panel ID="Panel1" runat="server">

                  <span >Product Description  </span><asp:TextBox ID="TextBox1" runat="server"  Width="200px"></asp:TextBox>

                  <span >Product ID</span><asp:TextBox ID="TextBox2" runat="server" Width="200px"></asp:TextBox>

                  <asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" />

              </asp:Panel>

              </form>

          </body>

          </html>

          Default.aspx.cs

          using System;

          using System.Collections.Generic;

          using System.Web;

          using System.Web.UI;

          using System.Web.UI.WebControls;

           

          namespace ServerPrintExample

          {

              public partial class _Default : System.Web.UI.Page

              {

                  protected void Button1_Click(object sender, EventArgs e)

                  {

                      System.Drawing.Printing.PrintDocument printdoc = new System.Drawing.Printing.PrintDocument();

                      printdoc.PrinterSettings.PrinterName = "CutePDF Writer";

                      printdoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printdoc_PrintPage);

                      printdoc.Print();

                  }

                  void printdoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)

                  {

                      e.Graphics.DrawString(this.TextBox1.Text, new System.Drawing.Font("Arial", 16.0f), System.Drawing.Brushes.Black, new System.Drawing.PointF(10.0f, 10.0f));

                      e.Graphics.DrawString(this.TextBox2.Text, new System.Drawing.Font("Free 3 of 9", 24.0F), System.Drawing.Brushes.Black, new System.Drawing.PointF(10.0f, 50.0f));

                  }

              }

          }

          1 of 1 people found this helpful
          • Re: How to print Barcode from MC9190-G (C#)

            Dear Rakesh,

            The question is not how to print a barcode from MC9xxx because you have wrote WebService to invoke its method which prints. I think you need using some library which generates barcode image object or image file. An image can be added to PrintDocument object before printing. Definitely the way is suggested by vince dibernardo is good. Keep in mind this case you need to install barcode font "Free 3 of 9" or other barcode fonts to PC where your WebService is hosted.

            Best regards

            Igor Andriychuk

            • Re: How to print Barcode from MC9190-G (C#)
              Robin West

              Hi Rakesh,

              If you want to print directly from the MC9xxx you might want to look into the information on using the RhoElements apd driver.  You shouldn't have to buy/license a font though if you are working with most thermal printers and printing from the server.  The barcode fonts are inherent in the printers and will print much better if use the built in barcodes.  Most thermal printer companies have drivers that will allow you to add the barcode you want to your font list.  It would likely be in the driver's print preferences.  You could then use it the same way that Vince mentions:

               

                 e.Graphics.DrawString(this.TextBox2.Text, new System.Drawing.Font("QR Code", 24.0F), System.Drawing.Brushes.Black, new System.Drawing.PointF(10.0f, 50.0f));

               

              Robin West

              Zebra Technologies

              • Re: How to print Barcode from MC9190-G (C#)
                1 of 1 people found this helpful