Go to file
2022-02-28 13:44:47 +01:00
.vscode initial commit 2022-02-17 16:45:42 +01:00
Controllers added qrcode 2022-02-28 13:44:47 +01:00
Instructions added qrcode 2022-02-28 13:44:47 +01:00
.gitignore initial commit 2022-02-17 16:45:42 +01:00
appsettings.Development.json initial commit 2022-02-17 16:45:42 +01:00
appsettings.json initial commit 2022-02-17 16:45:42 +01:00
LICENSE added license 2022-02-19 15:50:58 +01:00
printerApi.csproj initial commit 2022-02-17 16:45:42 +01:00
PrinterService.cs initial commit 2022-02-17 16:45:42 +01:00
Program.cs initial commit 2022-02-17 16:45:42 +01:00
README.md added basic README 2022-02-28 01:35:19 +01:00

Provide a JSON REST API to ESC/POS printers. Most of the time these printers will be thermal printers.

Usage

GET /api/printer/name to get the UUID of the printer.

GET /api/printer/status to get information about the current state of the printer.

To actually print something use POST /api/printer/print. The body is an JSON array of print instructions. Following instructions are available.

Feed

lines and dots can be used at the same time.

{
    "type":"feed",
    "lines":4,
    "dots":50
}

Text

Only text is required.

alignment: Can be Right,Left,Center. Default is Left.

underline,bold,doubleHeight,doubleWidth are obvious and default to false.

fontB: Use different font. Based on printer model. Default is false.

lineSpacing: Line spacings in dots. Default is unset.

newLine: Insert a new line after printing the text. Default is true.

{
    "type":"text",
    "text":"Hello world",
    "alignment":"Center",
    "underline": false,
    "bold": false,
    "doubleHeight":false,
    "doubleWidth":false,
    "fontB":false,
    "lineSpacing":23,
    "newLine":true
}

Barcode

barcode: Value of the barcode. Depending on the barcodeType it may only contain numeric characters. Require.

barcodeType: What type of barcode. Possible values are: CODE128, UPC_A,UPC_E,JAN13_EAN13,JAN8_EAN8,CODE39,ITF,CODABAR_NW_7,CODE93,GS1_128,GS1_DATABAR_OMNIDIRECTIONAL, GS1_DATABAR_TRUNCATED,GS1_DATABAR_LIMITED,GS1_DATABAR_EXPANDED. Default is CODE128. Depending on the printer modell not all types are supported.

barcodeCode: I honestly have no idea what exactly this changes. But it changes something. Default is CODE_B.

alignment: Just like alignment in the "Text" instruction.

labelPos: Position of the value of the barcode in text form. Possible values are : None, Above, Below, Both. Default is Below.

height: Height of the barcode in dots. Default is unset.

{
    "type":"barcode",
    "barcode":"348234445AA",
    "barcodeType":"CODE128",
    "barcodeCode":"CODE_B",
    "alignment":"Center",
    "labelPos":"None",
    "height":45,
}