npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-epson-epos2-2024

v1.0.4

Published

Cordova Plugin integrating the Epson ePOS2 SDK for iOS and Android support IOS 18

Downloads

17

Readme

cordova-plugin-epos2

Cordova plugin for Epson ePOS SDK(v2.6.0) for iOS and Android.

Integrates the Epson ePOS2 SDK for iOS and Android with a limited set of functions to discover and connect ePOS printers

Check supported devices and requirements from official SDK by Epson.

Install

cordova plugin add cordova-plugin-epson-epos2

API

The plugin exposes an interface object to cordova.epos2 for direct interaction with the SDK functions. See www/plugin.js for details about the available functions and their arguments. All API functions are asynchronous and return a Promise.

Printer Discovery

.startDiscover(discoverCallback)

This will search for supported printers connected to your mobiel device via Bluetooth or available in local area network (LAN)

cordova.epos2.startDiscover(function(deviceInfo) {
    // success callback with deviceInfo
}).catch(function(error) => {
    // error callback
});

.stopDiscover()

cordova.epos2.stopDiscover()
  .then(function() {
    // success callback
  })
  .catch(function(error) {
    // error callback
  });

.getSupportedModels()

Resolves with an array of strings denoting the supported printer models.

cordova.epos2.getSupportedModels()
  .then(function(models) {
    // success callback
  })
  .catch(function(error) {
    // error callback
  });

Printer Connection

.connectPrinter(device, printerModel)

Establish a connection to the given printer device. For device either provide a device information objects as retrieved from discovery or string with device address ('BT:xx:xx:xx:xx:xx' or 'TCP:xx.xx.xx.xx').

cordova.epos2.connectPrinter(device, printerModel)
  .then(function() {
    // success callback
  })
  .catch(function(error) {
    // error callback
  });

.disconnectPrinter()

cordova.epos2.disconnectPrinter()
  .then(function() {
    // success callback
  })
  .catch(function(error) {
    // error callback
  });

.getPrinterStatus()

cordova.epos2.getPrinterStatus()
  .then(function(status) {
    // success callback with status object
  })
  .catch(function(error) {
    // error callback
  });

Printing

.print(stringData, successCallback, errorCallback)

One-shot function printing the given text. Use '\n' in string data in order to move to next line. Cut feed is added automatically.

cordova.epos2.print(stringData, function() => {
    // success callback
}, function(error) => {
    // error callback
});

.printText(stringData, textFont, textSize, textAlign, terminate)

Send text to the connected printer. Also accepts parameters for font type, text size and alignment. Can be called multiple times for additional text lines. Set terminate to True in order to complete the print job and add cut feed.

cordova.epos2.printText(stringData, 0, 1, 2, false)
  .then(function() {}
    // success callback
  })
  .catch(function(error) => {
    // error callback
  });

.printImage(data, printMode, halfTone, terminate)

Send image data as data-url to the connected printer.

cordova.epos2.printImage(imageSource, 0, 0, false)
  .then(function() {}
    // success callback
  })
  .catch(function(error) => {
    // error callback
  });

Example

After successful discovery or entering the printer address, one can send a print job like this:

cordova.epos2.connectPrinter(device, model)
  .then(function() {
    return cordova.epos2.printText([
      'This is a printing demo from Cordova\n',
      'Composed using the cordova-plugin-epos2 plugin\n',
      '\n'
    ]);
  })
  .then(function() {
    // send image with `terminate` flag to complete the print job
    return cordova.epos2.printImage('data:image/png;base64,xxxxx', 0, 0, true);
  })
  .then(function() {
    return cordova.epos2.disconnectPrinter()
      .catch(function() { /* ignore disconnect errors */ });
  })
  .then(function() {
    console.log('Printing complete.');
  })
  .catch(function(err) {
    console.error('Printing failed', err);
  })

Platforms

  • iOS 9+
  • Android

License

MIT License