escpos-browser
v0.1.1
Published
Zero-dependency JavaScript library for direct Epson ePOS printing from modern web browsers over HTTPS.
Maintainers
Readme
escpos-browser
Unofficial, zero-dependency JavaScript library for direct Epson ePOS Print communication from modern web browsers.
It connects straight from the web page to a compatible Epson printer over HTTPS. No print dialog, browser extension, Node.js service, Epson SDK file, or cloud relay is required.
This project is not affiliated with or endorsed by Seiko Epson Corporation. Epson and ePOS are trademarks of their respective owner.
Requirements
- An Epson printer compatible with ePOS Print.
- ePOS Print and HTTPS enabled on the printer.
- A certificate trusted by every client device.
- CORS enabled by the printer firmware.
- The web app and printer must be mutually reachable on the network.
Quick start
<script src="https://your-app.example/js/escpos.js"></script>
<script>
const printer = Escpos.create({
host: "192.168.1.100",
deviceId: "local_printer"
});
async function printReceipt() {
const result = await printer.print(ticket => ticket
.center("MY STORE", { bold: true, width: 2, height: 2 })
.line()
.row("Coffee x 2", "$10.00")
.row("TOTAL", "$10.00", { bold: true })
.qr("https://example.com")
.feed(3)
.cut()
);
console.log(result);
}
</script>The library exposes the global Escpos object. See API.md for the full command list, images, barcodes, page mode, drawer control, errors, and Epson-compatible method names.
Testing
Run the automated command-serialization tests with npm test. For hardware validation, serve the repository over HTTP/HTTPS and open examples/command-tests.html. It provides an individual physical test for every printer command; effectful tests are highlighted in orange.
Distribution
Copy dist/escpos.js into your application and include it with a regular <script> tag. The file is self-contained and has no runtime dependencies.
Security notes
- Prefer a stable printer hostname or reserved IP address.
- Never disable TLS certificate verification in production.
- Trust only the certificate or issuing CA that belongs to the managed printer.
- Network access policies in modern browsers may vary according to the origin and deployment environment; test using the same browser and network as the production POS.
- Restrict printer network access to trusted POS clients.
Scope
Version 0.1.0 targets the Epson ePOS Print service. It does not implement Epson customer displays, scanners, keyboards, cash changers, or generic RAW TCP port 9100 printing from a browser.
