ESCPOSCommands 2026.4.19.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package ESCPOSCommands --version 2026.4.19.7
                    
NuGet\Install-Package ESCPOSCommands -Version 2026.4.19.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ESCPOSCommands" Version="2026.4.19.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ESCPOSCommands" Version="2026.4.19.7" />
                    
Directory.Packages.props
<PackageReference Include="ESCPOSCommands" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ESCPOSCommands --version 2026.4.19.7
                    
#r "nuget: ESCPOSCommands, 2026.4.19.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ESCPOSCommands@2026.4.19.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ESCPOSCommands&version=2026.4.19.7
                    
Install as a Cake Addin
#tool nuget:?package=ESCPOSCommands&version=2026.4.19.7
                    
Install as a Cake Tool

ESCPOSCommands

A lightweight .NET Standard 2.0 library for communicating with ESC/POS-compatible thermal receipt printers through the Windows print spooler (winspool.Drv). It provides a simple, fluent API to compose receipts with formatted text, barcodes, QR codes, images, paper cutting, and cash drawer control — all sent as raw ESC/POS byte commands without requiring a printer driver that supports GDI rendering.

Key Features

  • Text formatting — bold, underline, inverse, upside-down, double-width/height, and custom character sizes.
  • Alignment & positioning — left/center/right justification, absolute/relative print positions, margins, and horizontal tabs.
  • Barcodes — UPC-A, UPC-E, EAN-13, EAN-8, CODE39, ITF, CODABAR, CODE93, and CODE128 with configurable height, width, and HRI text position.
  • QR codes — configurable module size (1–16) with automatic centering.
  • Raster image printing — load, resize, convert to monochrome, and print any image file.
  • Paper cutting — full cut, partial cut, and standard GS V cut with configurable feed lines.
  • Cash drawer — open command via ESC p.
  • Character encoding — code page and international character set selection.
  • No GDI print driver required — sends raw bytes directly to the spooler.

Installation

dotnet add package ESCPOSCommands

Quick Start

using ESCPOSCommands;

var printer = new Commands("EPSON TM-T88VI Receipt");

printer.AddNewLine("Hello, World!");
printer.CutPaper();

printer.Print();
printer.Close();

API Reference & Examples

Text Output

Simple text line
printer.AddNewLine("Plain text line");
Formatted text line
// Centered text
printer.AddNewLine("CENTERED", Format.CenteredNormal, printWidth: 40);

// Bold text
printer.AddNewLine("BOLD LINE", Format.NormalBold);

// Centered + emphasized (double-width)
printer.AddNewLine("STORE NAME", Format.CenteredEmphasized, printWidth: 40);

// Centered + emphasized using ESC a alignment
printer.AddNewLine("RECEIPT TITLE", Format.CenteredEmphasized2);

// Double-height bold
printer.AddNewLine("TOTAL: $99.99", Format.DoubleHeightBold);

// Emphasized (double-width)
printer.AddNewLine("SUBTOTAL", Format.Emphasized);

Text Formatting (Composable)

Use these methods individually for fine-grained control instead of the Format enum:

// Bold on/off
printer.SetBold(true);
printer.AddNewLine("This line is bold");
printer.SetBold(false);

// Underline
printer.SetUnderline(UnderlineMode.OneDot);
printer.AddNewLine("Underlined text");
printer.SetUnderline(UnderlineMode.Off);

// Justification / alignment
printer.SetJustification(Justification.Center);
printer.AddNewLine("Centered line");
printer.SetJustification(Justification.Left);

// Inverse (white on black)
printer.SetInversePrinting(true);
printer.AddNewLine("Inverted colors");
printer.SetInversePrinting(false);

// Upside-down printing
printer.SetUpsideDown(true);
printer.AddNewLine("Upside down!");
printer.SetUpsideDown(false);

// Character size (width x height multipliers, 1-8)
printer.SetCharacterSize(widthMultiplier: 2, heightMultiplier: 2);
printer.AddNewLine("Double size text");
printer.SetCharacterSize(1, 1); // Reset to normal

Line Spacing

// Set custom line spacing (in dot units)
printer.SetLineSpacing(60);
printer.AddNewLine("Extra spaced line");

// Reset to default line spacing (~3.75mm)
printer.SetDefaultLineSpacing();

Blank Lines

// Insert 3 blank lines
printer.BlankLine(3);

Horizontal Tabs

// Set tab stop positions (in character columns)
printer.SetHorizontalTabPositions(10, 20, 30);

// Use tabs to align columns
printer.AddNewLine("Item" + "\t" + "Qty" + "\t" + "Price");

// Or use the HorizontalTab method
printer.AddNewLine("Apples");
printer.HorizontalTab();
printer.AddNewLine("5");
// Set absolute print position (in dots from left margin)
printer.SetAbsolutePosition(100);
printer.AddNewLine("Starts at dot 100");

// Set relative print position (offset from current position)
printer.SetRelativePosition(50);

// Set left margin (in dots)
printer.SetLeftMargin(20);

// Set print area width (in dots)
printer.SetPrintAreaWidth(400);

Character Encoding

// Select code page
printer.SetCodePage(CodePage.PC850_Multilingual);

// Select international character set
printer.SetInternationalCharset(InternationalCharset.LatinAmerica);

QR Code

// Print a QR code (centered, size 1-16)
printer.PrintQRCode("https://example.com", size: 8);

Barcode

// Print a CODE128 barcode with HRI text below
printer.PrintBarCode("ABC123", BarCodeType.CODE128, height: 100, width: 3, hriPosition: HriPosition.Below);

// Print an EAN-13 barcode
printer.PrintBarCode("4901234567890", BarCodeType.EAN13);

Image Printing

// Print an image from file (resized to specified width x height)
printer.PrintImage(
    imagePath: @"C:\logo.png",
    width: 200,
    height: 100,
    pageHeightInLines: 0,         // 0 = no vertical positioning
    blankColumnsBefore: 10        // left padding in columns
);

Paper Cutting

// Full cut (legacy ESC i)
printer.CutPaper();

// Partial cut (legacy ESC m)
printer.PartialCutPaper();

// Standard cut using GS V with configurable feed
printer.StandardCutPaper(CutMode.Partial, feedLines: 4);
printer.StandardCutPaper(CutMode.Full, feedLines: 6);

Cash Drawer

// Open the cash drawer
printer.OpenCashDrawer();

Printer Initialization

// Reset printer to default settings
printer.InitializePrinter();

Complete Receipt Example

using ESCPOSCommands;

var printer = new Commands("EPSON TM-T88VI Receipt");

// Header
printer.SetJustification(Justification.Center);
printer.SetCharacterSize(2, 2);
printer.AddNewLine("MY STORE");
printer.SetCharacterSize(1, 1);
printer.AddNewLine("123 Main Street");
printer.AddNewLine("Tel: (555) 123-4567");
printer.SetJustification(Justification.Left);
printer.BlankLine(1);

// Separator
printer.AddNewLine("--------------------------------");

// Items
printer.SetHorizontalTabPositions(20, 30);
printer.AddNewLine("Item\tQty\tPrice");
printer.AddNewLine("--------------------------------");
printer.AddNewLine("Widget A\t2\t$10.00");
printer.AddNewLine("Widget B\t1\t$25.00");
printer.AddNewLine("--------------------------------");

// Total
printer.SetBold(true);
printer.AddNewLine("TOTAL:\t\t$45.00");
printer.SetBold(false);
printer.BlankLine(1);

// QR code for digital receipt
printer.PrintQRCode("https://example.com/receipt/12345", size: 6);
printer.BlankLine(1);

// Footer
printer.SetJustification(Justification.Center);
printer.AddNewLine("Thank you for your purchase!");
printer.SetJustification(Justification.Left);

// Cut and finish
printer.StandardCutPaper(CutMode.Partial);
printer.Print();
printer.Close();

Enums Reference

Enum Values
Format Normal, Emphasized, CenteredNormal, CenteredEmphasized, NormalBold, DoubleHeightBold, NormalFontB, CenteredEmphasized2
Justification Left, Center, Right
UnderlineMode Off, OneDot, TwoDot
CutMode Full, Partial
BarCodeType UPC_A, UPC_E, EAN13, EAN8, CODE39, ITF, CODABAR, CODE93, CODE128
HriPosition None, Above, Below, Both
CodePage PC437_USA, Katakana, PC850_Multilingual, PC860_Portuguese, PC863_CanadianFrench, PC865_Nordic, PC1252_Windows, PC858_Euro, UTF8
InternationalCharset USA, France, Germany, UK, Denmark_I, Sweden, Italy, Spain_I, Japan, Norway, Denmark_II, Spain_II, LatinAmerica, Korea

Requirements

  • Platform: Windows (uses winspool.Drv P/Invoke)
  • Target: .NET Standard 2.0
  • Dependency: System.Drawing.Common

License

See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.4.19.14 118 4/19/2026
2026.4.19.7 111 4/19/2026
2026.4.19.3 114 4/19/2026