Barcode Printing in .Net

Brief:

Barcode printers comes up with ddl files which allows any programmer to communicate with the printer hardware and send print command. With parameters, we can specify X & Y co-rdinates from where to start the print. Mention what text to print, above or below barcode. We need to pass the code which is plotted as barcode. Same code is extracted back through barcode scanner and can be consumed in the program for further process. This implementation is done with TSC TTP 244 PLUS barcode printer.

Need:

Barcodes are extensively used in the manufacturing industries to identify a particular product or part. To print barcodes we need barcode printer. If you are creating an application (like inventory management software) for these customers then they insist to provide barcode printing facility. Along with barcode we can print some text as well. It helps to identify the product or part type/category sometimes or any other information like brand/manufacturer.

How It Works:


Barcode printers comes up with ddl files which allows any programmer to communicate with the printer hardware and send print command. With parameters, we can specify X & Y co-rdinates from where to start the print. The printing process is as follows.

1. To initialize Printer Thread.

PrinterThread.HiPerfTimer ht = new PrinterThread.HiPerfTimer();

2. Start the thread.

ht.Start();

3. Open printer port.

TSCBarcodePrinter.openport(this.objBPS.barcodePrinterName);

4. Configure printer for printing.

TSCBarcodePrinter.setup("35", "15", this.objBPS.setupLableSpeed, this.objBPS.setupLableDensity, this.objBPS.setupLableSensor, this.objBPS.setupLableVertical, this.objBPS.setupLableOffset);

5. Clear buffer of previous commands/settings.

TSCBarcodePrinter.clearbuffer();

6. Print text (company name) before barcode.

TSCBarcodePrinter.windowsfont(20, 5, 20, 0, 2, 0, this.objBPS.barcodeWindowsFontName, this.objBPS.companyName);

7. Print the barcode.

TSCBarcodePrinter.barcode(objBPS.barcodeX, objBPS.barcodeY, "128", "60", "1", "0", objBPS.barcodeNarrow, objBPS.barcodeWide, this.productBarcode);

8. Print text (product details) after barcode.

TSCBarcodePrinter.windowsfont(20, 88, 20, 0, 2, 0, this.objBPS.barcodeWindowsFontName, this.ProductDetail.ToUpper());

9. Print label

TSCBarcodePrinter.printlabel(this.objBPS.barcodeNumberOfSet, this.noOfCopies);

10. Close printer port

TSCBarcodePrinter.closeport();

11. Stop the thread

ht.Stop();

Boston Byte Grabs a Spot in Clutch’s List of Top Software Developers in Massachusetts

Boston Byte is a collective of highly-skilled and highly-professional developers dedicated to solving your technological ...