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

@sake12/my-cordova-plugin-bixolon-printer

v1.1.0

Published

A Cordova plugin for Bixolon printers.

Downloads

65

Readme

BixolonPrint Cordova Plugin

Note to Bringg Developers

This is fork of https://github.com/xyzxyz442/cordova-plugin-bixolon-print - with bug fix.

Cross-platform BixolonPrint Plugin for Cordova / PhoneGap. Forked from alfonsovinti

Adding support for QRCode, 1D BarCode, MSR Reader listener, Connection listener

Supported Platforms

  • Android (Using Bixolon SDK v2.2.9)
  • iOS (All new features still under development)

Installation

Below are the methods for installing this plugin automatically using command line tools.

Using the Cordova CLI

$ cordova plugin add my-cordova-plugin-bixolon-printer

Plugin Options

cordova.plugins.bixolonPrint.settings = {
  lineFeed: 3,
  formFeed: false,      // enable\disable jump to next position, in black marker and label modes
  autoConnect: true,    // Android only: if this is set to false displays a dialog box for selecting the printer
  toastMessage: true,   // Android only: show a printer message
  separator: '=',
  codePage: cordova.plugins.bixolonPrint.CodePage.CP_1252_LATIN1 // define code page, default value is set to CP_1252_LATIN1.
};

Available Code Page

CP_437_USA               : 0,
CP_KATAKANA              : 1,
CP_850_MULTILINGUAL      : 2,
CP_860_PORTUGUESE        : 3,
CP_863_CANADIAN_FRENCH   : 4,
CP_865_NORDIC            : 5,
CP_1252_LATIN1           : 16,
CP_866_CYRILLIC2         : 17,
CP_852_LATIN2            : 18,
CP_858_EURO              : 19,
CP_862_HEBREW_DOS_CODE   : 21, // Android only
CP_864_ARABIC            : 22,
CP_THAI42                : 23,
CP_1253_GREEK            : 24,
CP_1254_TURKISH          : 25,
CP_1257_BALTIC           : 26,
CP_FARSI                 : 27,
CP_1251_CYRILLIC         : 28,
CP_737_GREEK             : 29,
CP_775_BALTIC            : 30,
CP_THAI14                : 31,
CP_1255_HEBREW_NEW_CODE  : 33,
CP_THAI11                : 34, // Android only
CP_THAI18                : 35, // Android only
CP_855_CYRILLIC          : 36,
CP_857_TURKISH           : 37,
CP_928_GREEK             : 38,
CP_THAI16                : 39,
CP_1256_ARABIC           : 40,
CP_1258_VIETNAM          : 41, // Android only
CP_KHMER_CAMBODIA        : 42, // Android only
CP_1250_CZECH            : 43  // Android only

Available BarCode System

UPC_A: 65
UPC_E: 66
EAN13: 67
EAN8: 68,
CODE39: 69
ITF: 70
CODABAR: 71
CODE93: 72
CODE128: 73

Available QRCode Model

MODEL_1: 49
MODEL_2: 50

Using the plugin

The plugin creates the object cordova/plugin/BixolonPrint with following methods:

Add line to print

cordova.plugins.bixolonPrint.addLine({
    text       : String,    // text to print
    textAlign  : String,    // text align, default left
    textWidth  : int,       // text width, default 0
    textHeight : int,       // text height, default 0
    fontType   : String,    // font type, A or B
    fontStyle  : String     // font style, bold or underlined or reversed
});

Add line separator

cordova.plugins.bixolonPrint.addHr(separator String);

Print text lines

cordova.plugins.bixolonPrint.printText(successCallback, errorCallback, config Object);

Print Image (base64)

Print Image function based on https://github.com/itsKaynine/cordova-plugin-bixolon-printing Only work in Android with base64 formate

cordova.plugins.bixolonPrint.printBitmap(successCallback, errorCallback, config Object);

Cut paper

cordova.plugins.bixolonPrint.cutPaper(successCallback, errorCallback, config Object);

Get printer status

cordova.plugins.bixolonPrint.getStatus(successCallback, errorCallback, printStatus Boolean);

Print Barcode

var data = {
  text              : String,    // text to print
  alignment         : String,    // text align, default left (left, center, right)
  width             : int,       // 1 - 6
  height            : int,       //
  barcodeSystem     : int,       // see "cordova.plugins.bixolonPrint.BarCodeSystem"
  characterPosition : int        // see "cordova.plugins.bixolonPrint.BarCodeCharacterPosition"
};
cordova.plugins.bixolonPrint.printBarCode(data, successCallback, errorCallback, printStatus Boolean);

QRCode

var data = {
  text       : String,    // text to print
  alignment  : String,    // text align, default left (left, center, right)
  size       : int,       // text width, 1 - 8
  model      : int,       // see "cordova.plugins.bixolonPrint.QRCodeModel"
};
cordova.plugins.bixolonPrint.printQRCode(data, successCallback, errorCallback, printStatus Boolean);

Connection Listener

// Start connection listener
cordova.plugins.bixolonPrint.startConnectionListener(connectionCallback, errorCallback);

// Stop connection listener
cordova.plugins.bixolonPrint.stopConnectionListener(successCallback, errorCallback);

cordova.plugins.bixolonPrint.reconnect(successCallback, errorCallback);

cordova.plugins.bixolonPrint.disconnect(successCallback, errorCallback);

MSR Reader Listener

// Start MSR Reader listener
cordova.plugins.bixolonPrint.startMsrReaderListener(connectionCallback, errorCallback);

// Stop MSR Reader listener
cordova.plugins.bixolonPrint.stopMsrReaderListener(successCallback, errorCallback);

Examples

Print a text

cordova.plugins.bixolonPrint.addLine("hello cordova!\r\n");
cordova.plugins.bixolonPrint.printText();

Print a custom text

// compose text
cordova.plugins.bixolonPrint.addLine({
    text: "hello cordova!\r\n",
    textAlign: cordova.plugins.bixolonPrint.TextAlign.CENTER,
    fontStyle: cordova.plugins.bixolonPrint.FontStyle.BOLD
});
cordova.plugins.bixolonPrint.addHr();
cordova.plugins.bixolonPrint.addLine("#@*èòçìàé€");
// finally print
cordova.plugins.bixolonPrint.printText(
    function (response) {
        alert("print success!")
    },
    function (error) {
        alert("print failure: " + error)
    },
    {
        codePage: cordova.plugins.bixolonPrint.CodePage.CP_1252_LATIN1
    }
);

Print Image (base64)

cordova.plugins.bixolonPrint.printBitmap(successCallback, errorCallback, {
		base64Image: String, //base64 string
		width: Int, //width 
		brightness: int, // 0 to 100 (Bixolon recommeded 13 to 88)
		alignment: int,
});
function successCallback(e) {
	alert('success')
}
function errorCallback(e) {
 alert('error' + e);
}

Print Barcode

cordova.plugins.bixolonPrint.printBarCode({
  text: value,
  alignment: 'left', // left, center, right
  width: 2, // 1 - 6,
  height: 150,
  barcodeSystem: cordova.plugins.bixolonPrint.BarCodeSystem.CODE128,
  characterPosition: cordova.plugins.bixolonPrint.BarCodeCharacterPosition.BELOW_BAR_CODE
}, function(response) {
  alert("print success!")
}, function(error) {
  alert("print failure: " + error)
}, {
  codePage: cordova.plugins.bixolonPrint.CodePage.CP_THAI11
});

Print QRCode

cordova.plugins.bixolonPrint.printQRCode({
  text: value,
  alignment: 'center', // left, center, right
  size: 4, // 1 - 8,
  model: cordova.plugins.bixolonPrint.QRCodeModel.MODEL_2
}, function(response) {
  alert("print success!")
}, function(error) {
  alert("print failure: " + error)
}, {
  codePage: cordova.plugins.bixolonPrint.CodePage.CP_THAI11
});

Start/Stop MSR Reader Listener

var msrReaderRead = function(response) {
  // inside response contains keys [msrTrack1, msrTrack2, msrTrack3]
}

// printer must connected. to reconnect use this
cordova.plugins.bixolonPrint.reconnect();

cordova.plugins.bixolonPrint.startMsrReaderListener(
  msrReaderRead,
  function(error) {
    alert("MSR reader listener error: " + error)
  }
);

cordova.plugins.bixolonPrint.stopMsrReaderListener();

Start/Stop Connection Listener

var connectionMessageReceived = function(response) {
  // inside response contains keys [message, isConnected]
}

cordova.plugins.bixolonPrint.startConnectionListener(
  connectionMessageReceived,
  function(error) {
    alert("Connection listener error: " + error.message);
  }
);

cordova.plugins.bixolonPrint.stopConnectionListener();

Reconnect/Disconnect manually

// to reconnect
cordova.plugins.bixolonPrint.reconnect();

// to disconnect
cordova.plugins.bixolonPrint.disconnect();