receiptline / receiptline

Markdown for receipts. Printable digital receipts. Generate receipt printer commands and images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to override/extend printer implementations

IlyaSemenov opened this issue · comments

I would like to use my own open() for a ESC/POS printer that I work with.

However, all implementations live in a closure and there is no way to extend or provide an override.

I would expect at least something simple as:

const receipt_data = receiptline.transform(doc, {
	encoding: "cp866",
	command: "escpos",
	commands: {
		open: function (printer) { return "..." }
	},
})

Thank you for your feedback.

The command object interface was closed and experimental, but now it is stable.

We will consider extending the command object by users.

I think this would be fantastic! I have an Xprinter that supports ESCPOS, but does not have the "Buzzer" like an Epson printer might, or at least does not understand the command FS ( A pL pH fn m. The print works, it just prints AOC at the start of every receipt. Using sii removes that issue, but barcodes no longer work.

I can work around this with string manipulation, but it would be nice to have more control for some of the generic brand printers that are ESCPOS compatible.

Hello!

We have just released receiptline V1.7.0.

Printer implementations are now public. receiptline.commands.*

You can now override/extend printer implementations.

Please see receiptline/example/command/custom.js.

Thank you.