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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sunmi-printer-plugin

v1.0.0

Published

Cordova plugin wrapper for Sunmi PrinterX SDK on Android

Readme

Sunmi Printer Cordova Plugin

Cordova plugin wrapper for Sunmi PrinterX SDK (com.sunmi:printerx) on Android.

Features

  • Printer discovery and basic info query
  • Ticket printing (lineApi)
  • Label printing (canvasApi)
  • ESC/POS and TSPL command passthrough
  • Cash drawer control
  • Auto-injected JS bridge (SunmiPrinterSDK)

Install

Local install from current workspace:

cordova plugin add ./plugin-src

Install from npm:

cordova plugin add sunmi-printer-plugin

JS Entry

After plugin installation, SunmiPrinterSDK is injected by Cordova automatically. No manual <script src="js/sunmi-bridge.js"> include is required.

Required Initialization

Call initPrinter before any print, command, or cash drawer API:

SunmiPrinterSDK.initPrinter(
  function () {
    console.log("printer ready");
  },
  function (err) {
    console.error("initPrinter failed:", err);
  }
);

If not initialized, native side returns:

  • 打印机未初始化,请先调用 initPrinter

API Overview

Printer info

  • initPrinter(success, error)
  • getPrinterInfo(success, error)

Ticket printing

  • initLine(style, success, error)
  • printText(content, style, success, error)
  • addText(content, style, success, error)
  • printTexts(texts, weights, styles, success, error)
  • printBarCode(data, style, success, error)
  • printQrCode(data, style, success, error)
  • printBitmap(base64, style, success, error)
  • printDividingLine(style, success, error)
  • autoOut(success, error)
  • enableTransMode(enable, success, error)
  • printTrans(success, error)

Label printing

  • initCanvas(style, success, error)
  • renderArea(style, success, error)
  • renderText(content, style, success, error)
  • renderBarCode(data, style, success, error)
  • renderQrCode(data, style, success, error)
  • renderBitmap(base64, style, success, error)
  • printCanvas(count, success, error)

Command passthrough

  • sendEscCommand(hexData, success, error)
  • sendTsplCommand(data, success, error)

Cash drawer

  • open(success, error)
  • isOpen(success, error)

PrinterX Version Strategy

Default pinned version:

  • com.sunmi:printerx:1.0.18

Override from Gradle properties if needed:

  • Property name: SUNMI_PRINTERX_VERSION
  • Example: SUNMI_PRINTERX_VERSION=1.0.18
  • Project example file: gradle.properties.example
  • For Cordova Android builds, place this key in platforms/android/gradle.properties

The plugin resolves version in build-extras.gradle:

def sunmiPrinterxVersion = project.hasProperty("SUNMI_PRINTERX_VERSION")
    ? SUNMI_PRINTERX_VERSION
    : "1.0.18"

Notes

  • This plugin targets Android only.
  • Keep plugin-src as the source of truth. plugins/ and platforms/ are generated artifacts.

Release Checklist

Before publishing to npm:

cd plugin-src
npm test
npm run pack:check

Recommended before Android test submission:

cordova build android