Skip to content
Rallo edited this page Jul 11, 2022 · 3 revisions

How does the library work?

The EscPosLib it's a C# library that allows you to print in a very simple way on a standard ESC/POS thermal printer. Around the internet there are many libraries, but not simple ones. This project is aimed to people that have a basic or zero knowledge of ESC/POS language. With this library you will be able to print receipts, images, QR-Codes, Barcodes and (of course) simple text on ESC/POS printers.

Little technicality

All the commands within the library keep building an imaginary BUFFER that will be sent (all-in-one) to the printer once one of the Print commands are being called.

How do I use the library?

The library needs to be imported to your current project (it is not included in NuGet), which means you will have to import it manually into your SDK application. Once has been imported on top of your application file enable the library with using EscPosLib;

The Main Class

  • Printer This is our main class, the one we will use throughout the library, which is our printer. It supports 3 parameters:
  • IpAddress which is the printer's IP Address of course;
  • Port is the TCP port that your printer uses for printing, usually 9100 is the standard
  • Region is the region (type of alphabet) you will be using throughout the print, it will allow printing of special characters (like greek, cyrillic, thai, japanese, etc... alphabets).

Use the constuctor by creating a new printer, like so:

Printer yourPrinter = new Printer("YourIpAddress");
//or
Printer yourPrinter = new Printer("YourIpAddress", 9100);

About functions

public void Reset()

This operation initializes the printer and resets the whole existing BUFFER (by deleting it) is also deletes information such as:

  • QR-Codes in the printer image storage area;
  • Barcodes in the printer image storage area;
  • Region information (if not specified in the Region property of the Printer object);

This function will need to be called as the first after creating the Printer object.

receipt

Clone this wiki locally