Git Product home page Git Product logo

esc-pos-usb-net's Introduction

ESC-POS-USB-NET Logo

Printing ESC/POS Made Simple & Fast.

The most advanced open-source to build powerful thermal printing solution with no effort.


Buy Me A Coffee


ESC-POS-USB-NET is a free and open source .NET (C#) Implementation of the Epson ESC/POS Printing using USB Device Driver.

  • Focus on your business logic. With ESC-POS-USB-NET, you should focus on your business logic. we do the printing logic.
  • Customizable. You can quickly build your logic by fully customizing the code to fit your needs perfectly.=

Getting Started

follow the steps below:

โณ Installation

Use this Quickstart command to install in your project :

  • (Use nuget package manager to install (recommended))
Install-Package ESC-POS-USB-NET

or

  • (Use .Net Cli to install)
dotnet add package ESC-POS-USB-NET

This command install ESC-POS-USB-NET with your project.

Enjoy ๐ŸŽ‰

โค๏ธ Example Using C#

Import ESC_POS_USB_NET Printer Class:

using ESC_POS_USB_NET.Printer;

You can find printer name from (Windows): Control Panel->Hardware and Sound->Devices and Printers-> Your Printer's Name

Test Print:

Printer printer = new Printer("Printer Name");
printer.TestPrinter();
printer.FullPaperCut();
printer.PrintDocument();

Print Image:

Printer printer = new Printer("Printer Name");
Bitmap image =new Bitmap ( Bitmap.FromFile("Icon.bmp"));
printer.Image(image);
printer.FullPaperCut();
printer.PrintDocument();

Print Barcodes:

Printer printer = new Printer("Printer Name");
printer.Append("Code 128");
printer.Code128("123456789");
printer.Separator();
printer.Append("Code39");
printer.Code39("123456789");
printer.Separator();
printer.Append("Ean13");
printer.Ean13("1234567891231");
printer.FullPaperCut();
printer.PrintDocument();

Open Drawer:

Printer printer = new Printer("Printer Name");
printer.OpenDrawer();
printer.PrintDocument();

Different Types of Separators:

Printer printer = new Printer("Printer Name");
printer.Separator(); // Deafult
printer.Separator('.'); // .
printer.Separator('|'); // |
printer.Separator('='); // =
printer.Separator('+'); // +
printer.Separator('*'); // *
printer.Separator('^'); // ^
printer.Separator('~'); // ~
printer.Separator(':'); // :
printer.Separator('#'); // #
printer.FullPaperCut();
printer.PrintDocument();

Typography Test:

Printer printer = new Printer("Printer Name");
printer.Append("NORMAL - 48 COLUMNS");
printer.Append("1...5...10...15...20...25...30...35...40...45.48");
printer.Separator();
printer.Append("Text Normal");
printer.BoldMode("Bold Text");
printer.UnderlineMode("Underlined text");
printer.Separator();
printer.AppendWithoutLf("Text ");
printer.ReverseModeNoLF("reversed");
printer.Append(" and normal.");
printer.ReverseMode("Reversed text line.");
printer.Separator();
printer.ExpandedMode(PrinterModeState.On);
printer.Append("Expanded - 23 COLUMNS");
printer.Append("1...5...10...15...20..23");
printer.ExpandedMode(PrinterModeState.Off);
printer.Separator();
printer.CondensedMode(PrinterModeState.On);
printer.Append("Condensed - 64 COLUMNS");
printer.Append("1...5...10...15...20...25...30...35...40...45...50...55...60..64");
printer.CondensedMode(PrinterModeState.Off);
printer.Separator();
printer.DoubleWidth2();
printer.Append("Font Width 2");
printer.DoubleWidth3();
printer.Append("Font Width 3");
printer.NormalWidth();
printer.Append("Normal width");
printer.Separator();
printer.AlignRight();
printer.Append("Right aligned text");
printer.AlignCenter();
printer.Append("Center-aligned text");
printer.AlignLeft();
printer.Append("Left aligned text");
printer.Separator();
printer.Font("Font A", Fonts.FontA);
printer.Font("Font B", Fonts.FontB);
printer.Font("Font C", Fonts.FontC);
printer.Font("Font D", Fonts.FontD);
printer.Font("Font E", Fonts.FontE);
printer.Font("Font Special A", Fonts.SpecialFontA);
printer.Font("Font Special B", Fonts.SpecialFontB);
printer.Separator();
printer.InitializePrint();
printer.SetLineHeight(24);
printer.Append("This is first line with line height of 30 dots");
printer.SetLineHeight(40);
printer.Append("This is second line with line height of 24 dots");
printer.Append("This is third line with line height of 40 dots");
printer.NewLines(3);
printer.Append("End of Test :)");
printer.Separator();
printer.FullPaperCut();
printer.PrintDocument();

๐ŸŽˆ Features

  • Alignment: Left, Right and Center alignment.
  • BarCode: Code128, Code39, Ean13 barcodes are supported.
  • Drawer: Drawer Open facility.
  • Font Mode: Supported Bold, Underline, Expanded, Condensed modes.
  • Change Font: Change font to device specified FontA, FontB, FontC, FontD, FontE, SpecialFontA and SpecialFontB.
  • Font Width: Supported Normal, DoubleWidth2 and DoubleWidth3.
  • Image: Print BMP Image.
  • Paper Cut: Cut paper with Full & Partial Cut.
  • QrCode: Support 2D barcode (QrCode).

๐Ÿ– Requirements

Supported operating systems:

  • Ubuntu 18.04
  • Mac O/S
  • Windows 10

(Please note that ESC-POS-USB-NET may work on other operating systems, but these are not tested nor officially supported at this time.)

Dependencies:

  • .NETStandard 2.0
    • System.Drawing.Common (>= 4.6.0)
  • NetFramework 4.5

Dual-build - no more need to add netstandard2.0 if you want to use this library with generic netFramework.

We recommend always using the latest version of ESC-POS-USB-NET to start your new projects.

This project is currently in Under Development. Significant breaking changes are unlikely at this stage of the project, but using the latest version ensures you have all the latest features and updates. New releases are usually shipped every two weeks to fix/enhance the project.

๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Contributing

We welcome open an issue if you have any trouble.

๐Ÿ–จ๏ธ Printers information

You can look at file SPECIFIC-PRINTER-INFO to lookup some details about printers quirks (especially those cheap/clones from China).

๐Ÿ“ License

MIT License Copyright (c) 2019 MTM Suhail.

โค๏ธ Support

"Buy Me A Coffee"

esc-pos-usb-net's People

Contributors

mtmsuhail avatar saper-2 avatar kvishalv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.