zachzurn / thermal

🖨️ Render Images and HTML from ESC/POS
Apache License 2.0
38 stars 4 forks source link

Implement Conversion of Espon Plaintext format #22

Closed zachzurn closed 1 month ago

zachzurn commented 1 month ago

Epson has an example format for receipts that looks like it can be parsed and converted into binary format.

See: https://download4.epson.biz/sec_pubs/pos/reference_en/escpos/receipt.html

If anyone wants to take a stab at it and send a pull request, I'm happy to bring it in.

Rough idea for the parsing:

Map

'// ============================================================================
'// Issuing receipts
'// ============================================================================

'// Initialize printer
    ESC "@"

'// --- Print stamp --->>>
'// Set line spacing: For the TM-T20, 1.13 mm (18/406 inches)
    ESC "3" 18
'// Set unidirectional print mode: Cancel unidirectional print mode (Unnecessary
'// in the TM-T20, so it is comment out)
'//   For models equipped with the ESC U command, implementation is recommended.
'//   Designate unidirectional printing with the ESC U command to get a print
'//   result with equal upper and lower parts for the stamp frame symbol
'//    ESC "U" 1
'// Select justification: Centering
    ESC "a" 1
zachzurn commented 1 month ago

This is now done and merged into main.