All Projects → ingoncalves → escpos-xml

ingoncalves / escpos-xml

Licence: Apache-2.0 License
JavaScript library that implements the thermal printer ESC / POS protocol and provides an XML interface for preparing templates for printing.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to escpos-xml

Vip.Printer
Biblioteca para realizar impressões (impressora não fiscal) utilizando comandos Esc/Bema, Esc/Daruma e Esc/Pos 🚀
Stars: ✭ 48 (+29.73%)
Mutual labels:  printer, escpos
Escpos Php
PHP library for printing to ESC/POS-compatible thermal and impact printers
Stars: ✭ 1,851 (+4902.7%)
Mutual labels:  printer, escpos
quickprinter
[Quick Printer] Created for the purpose of serving as a channel among other applications that require printing data on receipt printers using ESC / POS commands.
Stars: ✭ 99 (+167.57%)
Mutual labels:  printer, escpos
ESCPOS
A ESC/POS Printer Commands Helper
Stars: ✭ 26 (-29.73%)
Mutual labels:  printer, escpos
python-escpos
Fork of https://code.google.com/p/python-escpos/
Stars: ✭ 27 (-27.03%)
Mutual labels:  printer, escpos
escper
Ruby gem for printing of images and text on one or many thermal printers
Stars: ✭ 67 (+81.08%)
Mutual labels:  escpos
MultiStateToggleButton
Android's ToggleButton offers only two states, MultiStateToggleButton fixes this by offering as many states depending on the number of drawable resources passed in.
Stars: ✭ 20 (-45.95%)
Mutual labels:  xml
Graffino-Docker-Ninja
Webpack 4 based boilerplate to jumpstart your static or WordPress project.
Stars: ✭ 12 (-67.57%)
Mutual labels:  handlebars
pt1230
Brother P-Touch 1230PC Linux interface
Stars: ✭ 25 (-32.43%)
Mutual labels:  printer
moment-holiday
A Moment.js plugin for handling holidays. NO LONGER MAINTAINED (DEPRECATED)
Stars: ✭ 82 (+121.62%)
Mutual labels:  momentjs
learn-xquery
A list of great articles, blog posts, and books for learning XQuery
Stars: ✭ 33 (-10.81%)
Mutual labels:  xml
medialytics
A basic, free tool that shows information about Plex Media Server content
Stars: ✭ 31 (-16.22%)
Mutual labels:  xml
onixcheck
ONIX validation library and commandline tool
Stars: ✭ 20 (-45.95%)
Mutual labels:  xml
xml2json
Xml To Json
Stars: ✭ 32 (-13.51%)
Mutual labels:  xml
fiet
Fiết is a RSS feed parser in Elixir, which focuses on extensibility, speed, and standard compliance
Stars: ✭ 23 (-37.84%)
Mutual labels:  xml
GDX-HTML
using HTML + CSS + JS to build libGDX UI!
Stars: ✭ 21 (-43.24%)
Mutual labels:  xml
stacy
Website generator that combines content from Contentful CMS with Handlebars templates and publishes the website in Amazon S3.
Stars: ✭ 24 (-35.14%)
Mutual labels:  handlebars
node-backend-template
A template for NodeJS backend projects
Stars: ✭ 19 (-48.65%)
Mutual labels:  handlebars
Server-Help
💻 This VSTO Add-In allows the user to ping a list of servers and creates a file for Microsoft Remote Desktop Manager an Excel table. This is used for quickly determining which servers are offline in a list. It is written in 3 different versions as a VSTO Add-In in C# and VB.NET as well as a VBA Add-In.
Stars: ✭ 21 (-43.24%)
Mutual labels:  xml
asl
A C++ cross-platform library including JSON, XML, HTTP, Sockets, WebSockets, threads, processes, logs, file system, CSV, INI files, etc.
Stars: ✭ 44 (+18.92%)
Mutual labels:  xml

ESC/POS XML

JavaScript library that implements the thermal printer ESC / POS protocol and provides an XML interface for preparing templates for printing.

Features:

  • Text
  • Text line
  • Feed line
  • Bold text
  • Underline text
  • Font size
  • Small mode
  • White mode
  • Align
  • Barcode
  • QRcode
  • Paper cut node
  • Image
  • XML with Handlebars
  • Handlebars Moment Helper
  • Handlebars Numeral Helper

Installation

Using npm:

npm install --save escpos-xml

Usage

In JavaScript:

From plain XML

import { EscPos } from 'escpos-xml';

const xml = `
  <?xml version="1.0" encoding="UTF-8"?>
  <document>
    <text-line>hello world</text-line>
  </document>
`;

const buffer = EscPos.getBufferXML(xml);
// send this buffer to a stream (eg.: bluetooth)

From XML + Handlebars

import { EscPos } from 'escpos-xml';

const xml = `
  <?xml version="1.0" encoding="UTF-8"?>
  <document>
    <text-line>{{foo}}</text-line>
  </document>
`;

const data = {
  foo: 'hello word'
};

const buffer = EscPos.getBufferFromTemplate(xml, data);
// send this buffer to a stream (eg.: bluetooth)

From Builder

import { EscPos } from 'escpos-xml';


const buffer = EscPos.getBufferBuilder()
                             .printTextLine('hello world')
                             .build();
// send this buffer to a stream (eg.: bluetooth)

API

Comming soon... For a while, this example may help you:

import { EscPos } from 'escpos-xml';

const xml = `
  <?xml version="1.0" encoding="UTF-8"?>
  <document>
      <line-feed />
      <align mode="center">
          <bold>
              <text-line size="1:1">{{title}}</text-line>
          </bold>
          <line-feed />
          <small>
              <text-line>{{subtitle}}</text-line>
          </small>
      </align>
      <small>
          <text-line>Date: {{moment date format="DD/MM/YYYY HH:mm:ss"}}</text-line>
          <text-line size="1:0">{{numeral price format="$ 0,0.00"}}</text-line>
          <text-line size="1:0">{{paddedString}}</text-line>
      </small>
      <line-feed />
      <underline>
        <text-line>{{underline}}</text-line>
      </underline>
      <line-feed />
      <align mode="center">
          <white-mode>
              <text-line size="1:1">{{description}}</text-line>
          </white-mode>
          <line-feed />
          <bold>
              {{#if condictionA}}
              <text-line size="1:0">True A</text-line>
              {{else if condictionB}}
              <text-line size="1:0">True B</text-line>
              {{else}}
              <text-line size="1:0">False</text-line>
              {{/if}}
          </bold>
      </align>
      <line-feed />
      <align mode="center">
          <barcode system="CODE_128" width="DOT_250">{{barcode}}</barcode>
      </align>
      <line-feed />
      <align mode="center">
          <qrcode ecl="M">{{qrcode}}</qrcode>
      </align>
    <paper-cut/>
  </document>
`;

const data = {
  title: 'Tile',
  subtitle: 'Subtitle',
  description: 'This is a description',
  date: new Date(),
  price: 1.99,
  paddedString: '&nbsp;&nbsp;&nbsp;&nbsp;Line padded with 4 spaces',
  condictionA: false,
  condictionB: true,
  barcode: '12345678',
  qrcode: 'hello qrcode',
  underline: 'underline'
}

const buffer = EscPos.getBufferFromTemplate(xml, data);
// send this buffer to a stream (eg.: bluetooth)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].