Skip to content

Thermal file format

zachzurn edited this page Oct 13, 2024 · 2 revisions

The Thermal library can parse binary format but can also parse the format that Epson uses on their website for programming examples.

This format can be used for creating tests or for creating documented receipt files.

The format is very simple:

Comments

Comments are lines that start with '//.

'// This is a comment and will not affect the final receipt

Text

Surround text in double quotes. Double quotes can be escaped with a backslash. Backslashes do not need to be escaped.

"This text will be printed"
"This is a \" quote and this \ is a backslash"
"ESC will print ESC and will not be a constant"

Binary

Binary can be represented with hex codes like this: 0xFF.

Decimal

Decimal should not be quoted. This is an example of using a decimal in a line:

'// Set horizontal tab positions: 35th column
    ESC "D" 35 0

Constants

Constants are words that represent commonly used command bytes. For example ESC represents the ESC character or 1B in hex.

Available constants are:

  • NUL Null command
  • ESC Escape character code used for common commands
  • HT Horizontal tab
  • LF Line Feed
  • FF Form Feed
  • CR Carriage Return
  • GS Group separator, used for graphics commands
  • FS File Separator, used for some commands
  • DLE Data Line Escape, used for some commands
  • CAN Cancel, used for some commands

Example of using some constants. This line would print TM-Hxx tab 6.00 newline.

'// Detail text data and horizontal tab, print and line feed
    "TM-Hxxx" HT "  6.00" LF

Examples

For more extensive examples, look at the sample_files/in directory. Files with the .thermal extension will have a lot of examples to learn from.

Clone this wiki locally