ReceiptSharp 1.0.0
dotnet add package ReceiptSharp --version 1.0.0
NuGet\Install-Package ReceiptSharp -Version 1.0.0
<PackageReference Include="ReceiptSharp" Version="1.0.0" />
<PackageVersion Include="ReceiptSharp" Version="1.0.0" />
<PackageReference Include="ReceiptSharp" />
paket add ReceiptSharp --version 1.0.0
#r "nuget: ReceiptSharp, 1.0.0"
#:package ReceiptSharp@1.0.0
#addin nuget:?package=ReceiptSharp&version=1.0.0
#tool nuget:?package=ReceiptSharp&version=1.0.0
ReceiptSharp
.NET printing library for receipt printers, simple and easy with receipt markdown, printer status support.
using ReceiptSharp;
string example = @"^^^RECEIPT
11/30/2025, 12:34:56 PM
Asparagus | 1| 1.00
Broccoli | 2| 2.00
Carrot | 3| 3.00
---
^TOTAL | ^6.00";
ReceiptSession session = new ReceiptSession("192.168.192.168");
session.Ready += async (sender, e) => Console.WriteLine(await session.Print(example));
session.Open();
Console.ReadLine();
session.Close();
Console.WriteLine(new Receipt(example).ToSvg());

Features
ReceiptSharp is simple printing library for receipt printers that prints with easy markdown data for receipts and returns printer status. Even without a printer, it can output images.
ReceiptSharp auto-detects printer models for seamless printing.
A development tool is provided to edit, preview, and print the receipt markdown.
https://receiptline.github.io/receiptjs-designer/
Receipt printers
- Epson TM series
- Seiko Instruments RP series
- Star MC series
- Citizen CT series
- Fujitsu FP series
Connect with IP address or serial port.
(LAN, Bluetooth, virtual serial port, and real serial port)
Epson TM series (South Asia model) and Star MC series (StarPRNT model) can print with device font of Thai characters.

ReceiptSession Class
Namespace: ReceiptSharp
Print receipt markdown text and notify printer status.
Examples
using ReceiptSharp;
string example = @"^^^RECEIPT
11/30/2025, 12:34:56 PM
Asparagus | 1| 1.00
Broccoli | 2| 2.00
Carrot | 3| 3.00
---
^TOTAL | ^6.00";
ReceiptSession session = new ReceiptSession("COM1");
session.StatusChanged += (sender, e) =>
{
Console.WriteLine(e);
};
session.Ready += async (sender, e) =>
{
string result = await session.Print(example, "-c 42 -u");
Console.WriteLine(result);
};
session.Open();
Console.ReadLine();
session.Close();
Constructors
| Name | Description |
|---|---|
| ReceiptSession(String) | Create instance. |
Properties
| Name | Description |
|---|---|
| Status | Printer status. |
| Drawer | Cash drawer status. |
Methods
| Name | Description |
|---|---|
| Open() | Open session. |
| Print(String, String) | Print receipt markdown. |
| InvertDrawerState(Boolean) | Invert cash drawer state. |
| Close() | Close session. |
Events
| Name | Description |
|---|---|
| StatusChanged | Printer status updated. |
| Ready | Ready to print. |
| Online | Printer is online. |
| CoverOpen | Printer cover is open. |
| PaperEmpty | No receipt paper. |
| Error | Printer error (except cover open and paper empty). |
| Offline | Printer is off or offline. |
| Disconnect | Printer is not connected. |
| DrawerChanged | Drawer status updated. |
| DrawerClosed | Drawer is closed. |
| DrawerOpen | Drawer is open. |
ReceiptSession Constructor
public ReceiptSession(string destination)
The ReceiptSession() constructor creates a new ReceiptSession instance.
Parameters
destination- IP address or serial port of target printer
Serial port options:
"COM1:115200N81"
<port name>[:<options>]<options><baud rate>,<parity>,<data bits>,<stop bits>[,<flow control>]- Default:
9600,N,8,1,N - Commas can be omitted
<baud rate>2400,4800,9600,19200,38400,57600,115200
<parity>N: None,E: Even,O: Odd
<data bits>8,7
<stop bits>1,2
<flow control>N: None,R: RTS/CTS,X: XON/XOFF
Returns
- A new ReceiptSession instance.
ReceiptSession.Status Property
public string Status { get; }
The Status property is a string representing the printer status.
Property Value
- A string representing the printer status.
Online: Printer is onlinePrint: Printer is printingCoverOpen: Printer cover is openPaperEmpty: No receipt paperError: Printer error (except cover open and paper empty)Offline: Printer is off or offlineDisconnect: Printer is not connected
ReceiptSession.Drawer Property
public string Drawer { get; }
The Drawer property is a string representing the cash drawer status.
Property Value
- A string representing the cash drawer status.
DrawerClosed: Drawer is closedDrawerOpen: Drawer is openOffline: Printer is off or offlineDisconnect: Printer is not connected
ReceiptSession.Open Method
public void Open()
The Open() method starts a session and connects to the target printer.
ReceiptSession.Print Method
public async Task<string> Print(string markdown, string options = "")
The Print() method prints a receipt markdown text.
Parameters
markdown- Receipt markdown text
options-c <chars>: Characters per line- Range:
24-96 - Default:
48
- Range:
-l <language>: Language of receipt markdown texten,fr,de,es,po,it,ru, ...: Multilingual (cp437, 852, 858, 866, 1252 characters)ja: Japanese (shiftjis characters)ko: Korean (ksc5601 characters)zh-hans: Simplified Chinese (gb18030 characters)zh-hant: Traditional Chinese (big5 characters)th: Thai- Default: System locale
-s: Paper saving (reduce line spacing)-m [<left>][,<right>]: Print margin- Range (left):
0-24 - Range (right):
0-24 - Default:
0,0
- Range (left):
-u: Upside down-i: Print as image Not implemented-n: No paper cut-b <threshold>: Image thresholding- Range:
0-255 - Default: Error diffusion
- Range:
-g <gamma>: Image gamma correction- Range:
0.1-10.0 - Default:
1.0
- Range:
-p <printer>: Printer control languageescpos: ESC/POS (Epson)epson: ESC/POS (Epson)sii: ESC/POS (Seiko Instruments)citizen: ESC/POS (Citizen)fit: ESC/POS (Fujitsu)impact: ESC/POS (TM-U220)impactb: ESC/POS (TM-U220 Font B)generic: ESC/POS (Generic) Experimentalstar: StarPRNTstarline: Star Line Modeemustarline: Command Emulator Star Line Modestargraphic: Star Graphic Modestarimpact: Star Mode on dot impact printers Experimentalstarimpact2: Star Mode on dot impact printers (Font 5x9 2P-1) Experimentalstarimpact3: Star Mode on dot impact printers (Font 5x9 3P-1) Experimental- Default: Auto detection (
epson,sii,citizen,fit,impactb,generic,star)
-v: Landscape orientation- Device font support:
escpos,epson,sii,citizen,star
- Device font support:
-r <dpi>: Print resolution for ESC/POS, landscape, and device font- Values:
180,203 - Default:
203
- Values:
Returns
- A Task that fulfills with a string once the print result is ready to be used.
Success: Printing successPrint: Printer is printingCoverOpen: Printer cover is openPaperEmpty: No receipt paperError: Printer error (except cover open and paper empty)Offline: Printer is off or offlineDisconnect: Printer is not connected
ReceiptSession.InvertDrawerState Method
public void InvertDrawerState(bool invert)
The InvertDrawerState() method inverts cash drawer state.
Parameters
invert- If true, invert drawer state
ReceiptSession.Close Method
public void Close()
The Close() method closes the connection and ends the session.
Receipt Class
Namespace: ReceiptSharp
Convert to image, plain text, or printer commands.
Examples
using ReceiptSharp;
string example = @"^^^RECEIPT
11/30/2025, 12:34:56 PM
Asparagus | 1| 1.00
Broccoli | 2| 2.00
Carrot | 3| 3.00
---
^TOTAL | ^6.00";
Receipt receipt = new Receipt(example, "-c 42 -l en");
string svg = receipt.ToSvg();
Console.WriteLine(svg);
string txt = receipt.ToText();
Console.WriteLine(txt);
Constructors
| Name | Description |
|---|---|
| Receipt(String, String) | Create instance. |
Methods
| Name | Description |
|---|---|
| ToSvg() | Convert receipt markdown to SVG. |
| ToPng() | Convert receipt markdown to PNG. Not implemented |
| ToText() | Convert receipt markdown to text. |
| ToCommand() | Convert receipt markdown to printer commands. |
| ToString() | Return string representing this object. |
Receipt Constructor
public Receipt(string markdown, string options = "")
The Receipt() constructor creates a new Receipt instance.
Parameters
markdown- Receipt markdown text
options-p <printer>: Printer control languageescpos: ESC/POS (Epson)epson: ESC/POS (Epson)sii: ESC/POS (Seiko Instruments)citizen: ESC/POS (Citizen)fit: ESC/POS (Fujitsu)impact: ESC/POS (TM-U220)impactb: ESC/POS (TM-U220 Font B)generic: ESC/POS (Generic) Experimentalstar: StarPRNTstarline: Star Line Modeemustarline: Command Emulator Star Line Modestargraphic: Star Graphic Modestarimpact: Star Mode on dot impact printers Experimentalstarimpact2: Star Mode on dot impact printers (Font 5x9 2P-1) Experimentalstarimpact3: Star Mode on dot impact printers (Font 5x9 3P-1) Experimental
-c <chars>: characters per line- Range:
24-96 - Default:
48
- Range:
-l <language>: Language of receipt markdown texten,fr,de,es,po,it,ru, ...: Multilingual (cp437, 852, 858, 866, 1252 characters)ja: Japanese (shiftjis characters)ko: Korean (ksc5601 characters)zh-hans: Simplified Chinese (gb18030 characters)zh-hant: Traditional Chinese (big5 characters)th: Thai- Default: System locale
-s: Paper saving (reduce line spacing)-m [<left>][,<right>]: Print margin- Range (left):
0-24 - Range (right):
0-24 - Default:
0,0
- Range (left):
-u: Upside down-i: Print as image Not implemented-n: No paper cut-b <threshold>: Image thresholding- Range:
0-255 - Default: Error diffusion
- Range:
-g <gamma>: Image gamma correction- Range:
0.1-10.0 - Default:
1.0
- Range:
-v: Landscape orientation- Device font support:
escpos,epson,sii,citizen,star
- Device font support:
-r <dpi>: Print resolution for ESC/POS, landscape, and device font- Values:
180,203 - Default:
203
- Values:
Returns
- A new Receipt instance.
Receipt.ToSvg Method
public string ToSvg()
The ToSvg() method converts to SVG.
Returns
- A string representing the SVG.
Receipt.ToPng Method
public string ToPng()
The ToPng() method converts to PNG.
Returns
- A string representing the PNG in data URL format.
Receipt.ToText Method
public string ToText()
The ToText() method converts to plain text.
Returns
- A string representing the plain text.
Receipt.ToCommand Method
public byte[] ToCommand()
The ToCommand() method converts to printer commands.
Returns
- A byte array representing the printer commands.
Receipt.ToString Method
public override string ToString()
The ToString() method returns a string representing the receipt markdown text.
Returns
- A string representing the receipt markdown text.
Receipt Markdown
This language conforms to the OFSC ReceiptLine Specification.
https://www.ofsc.or.jp/receiptline/en/
ReceiptLine is the receipt description language that expresses the output image of small roll paper.
It supports printing paper receipts using a receipt printer and displaying electronic receipts on a POS system or smartphone.
It can be described simply with receipt markdown text data that does not depend on the paper width.
Syntax
Railroad diagram
document

line

columns

column

text

char

escape

ws (whitespace)

property

member

key

value

Grammar
Structure
The receipt is made of a table, which separates each column with a pipe |.
| Line | Content | Description |
|---|---|---|
| column<br><code>|</code> column <code>|</code><br><code>|</code> column<br>column <code>|</code> | Text<br>Property | Single column |
| column <code>|</code> column <br><code>|</code> column <code>|</code> column <code>|</code><br><code>|</code> column <code>|</code> column<br>column <code>|</code> column <code>|</code> | Text | Double column |
| column <code>|</code> ... <code>|</code> column<br><code>|</code> column <code>|</code> ... <code>|</code> column <code>|</code><br><code>|</code> column <code>|</code> ... <code>|</code> column<br>column <code>|</code> ... <code>|</code> column <code>|</code> | Text | Multiple columns |
Alignment
The column is attracted to the pipe | like a magnet.
<code>␣</code> means one or more whitespaces.
| Column | Description |
|---|---|
| column<br><code>|</code>column<code>|</code><br><code>|␣</code>column<code>␣|</code> | Center |
| <code>|</code>column<br><code>|</code>column<code>␣|</code><br>column<code>␣|</code> | Left |
| column<code>|</code><br><code>|␣</code>column<code>|</code><br><code>|␣</code>column | Right |
Text
The text is valid for any column.
Asparagus | 0.99
Broccoli | 1.99
Carrot | 2.99
---
^TOTAL | ^5.97
Characters are printed in a monospace font (12 x 24 px).
Wide characters are twice as wide as Latin characters (24 x 24 px).
Control characters are ignored.
Special characters in text
Special characters are assigned to characters that are rarely used in the receipt.
| Special character | Description |
|---|---|
\ |
Character escape |
| <code>|</code> | Column delimiter |
{ |
Property delimiter (Start) |
} |
Property delimiter (End) |
- (1 or more, exclusive) |
Horizontal rule |
= (1 or more, exclusive) |
Paper cut |
~ |
Space |
_ |
Underline |
" |
Emphasis |
` |
Invert |
^ |
Double width |
^^ |
Double height |
^^^ |
2x size |
^^^^ |
3x size |
^^^^^ |
4x size |
^^^^^^ |
5x size |
^^^^^^^ (7 or more) |
6x size |
Escape sequences in text
Escape special characters.
| Escape sequence | Description |
|---|---|
\\ |
\ |
| <code>\|</code> | | |
\{ |
{ |
\} |
} |
\- |
- (Cancel horizontal rule) |
\= |
= (Cancel paper cut) |
\~ |
~ |
\_ |
_ |
\" |
_ |
\` |
` |
\^ |
^ |
\n |
Wrap text manually |
\xnn |
Hexadecimal character code |
\char (Others) |
Ignore |
Properties
The property is valid for lines with a single column.
Text, images, barcodes, and 2D codes cannot be placed on the same line.
{ width: * 10; comment: the column width is specified in characters }
| Key | Abbr | Value | Default | Description |
|---|---|---|---|---|
image |
i |
base64 png format | - | Insert image<br>Drag a PNG file, hold [Shift] and drop it on a blank line<br>(Recommended: monochrome, critical chunks only) |
code |
c |
textdata | - | Insert barcode / 2D code |
command |
x |
textdata | - | Insert device-specific commands |
comment |
_ |
textdata | - | Insert comment |
option |
o |
see below | code128 2 72 nohri 3 l |
Set barcode / 2D code options<br>(Options are separated by commas or one or more whitespaces) |
border |
b |
line<br>space<br>none<br>0 - 2 |
space |
Set column border (chars)<br>(Border width: line=1, space=1, none=0) |
width |
w |
auto<br>*<br>0 - |
auto<br>(* for all columns) |
Set column widths (chars)<br>(Widths are separated by commas or one or more whitespaces) |
align |
a |
left<br>center<br>right |
center |
Set line alignment<br>(Valid when line width < characters per line) |
text |
t |
wrap<br>nowrap |
wrap |
Set text wrapping |
Barcode options
Barcode options are separated by commas or one or more whitespaces.
| Barcode option | Description |
|---|---|
upc |
UPC-A, UPC-E<br>(Check digit can be omitted) |
ean<br>jan |
EAN-13, EAN-8<br>(Check digit can be omitted) |
code39 |
CODE39 |
itf |
Interleaved 2 of 5 |
codabar<br>nw7 |
Codabar (NW-7) |
code93 |
CODE93 |
code128 |
CODE128 |
2 - 4 |
Barcode module width (px) |
24 - 240 |
Barcode module height (px) |
hri |
With human readable interpretation |
nohri |
Without human readable interpretation |
2D code options
2D code options are separated by commas or one or more whitespaces.
| 2D code option | Description |
|---|---|
qrcode |
QR Code |
3 - 8 |
Cell size (px) |
l<br>m<br>q<br>h |
Error correction level |
Special characters in property values
Special characters in property values are different from special characters in text.
| Special character | Description |
|---|---|
\ |
Character escape |
| <code>|</code> | Column delimiter |
{ |
Property delimiter (Start) |
} |
Property delimiter (End) |
: |
Key-value separator |
; |
Key-value delimiter |
Escape sequences in property values
Escape special characters.
| Escape sequence | Description |
|---|---|
\\ |
\ |
| <code>\|</code> | | |
\{ |
{ |
\} |
} |
\; |
; |
\n |
New line |
\xnn |
Hexadecimal character code |
\char (Others) |
Ignore |
| Product | Versions 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. |
-
.NETStandard 2.0
- SkiaSharp (>= 3.119.1)
- System.IO.Ports (>= 10.0.0)
- System.Text.Encoding.CodePages (>= 10.0.0)
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 |
|---|---|---|
| 1.0.0 | 265 | 11/30/2025 |