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

react-native-zywell-thermal-printer

v1.0.1

Published

Native bridge for Zywell Thermal printer in React Native applications

Downloads

82

Readme

react-native-zywell-thermal-printer

Native bridge for Zywell Thermal printer Zywell Official Site

Features

  • Easy integration with Zywell thermal printers
  • Supports both iOS and Android
  • High performance and reliability Compatible with thermal printers, Bluetooth printers, LAN printers, and more.(print text, print image,... With size 80mm, 58mm, A4 with customize, ...)

Since this library serves personal purposes, there will not be many updates. If there are any updates, please create a pull request or an issue. Thank you.

Installation

npm install react-native-zywell-thermal-printer
# or
yarn add react-native-zywell-thermal-printer

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />

Please check for additional permissions required by the library.

https://www.npmjs.com/package/react-native-bluetooth-escpos-printer

https://www.npmjs.com/package/react-native-bluetooth-state-manager

https://github.com/HeligPfleigh/react-native-thermal-receipt-printer

Usage

import ZywellPrinter from 'react-native-zywell-thermal-printer';

// Connect to a Bluetooth printer
ZywellPrinter.connectBLE('00:11:22:33:FF:EE')
  .then(() => {
    console.log('Connected to Bluetooth printer');
  })
  .catch((error) => {
    console.error('Failed to connect to Bluetooth printer', error);
  });

// Connect to a network printer
ZywellPrinter.connectNet('192.168.xx.xxx')
  .then(() => {
    console.log('Connected to network printer');
  })
  .catch((error) => {
    console.error('Failed to connect to network printer', error);
  });

// Print an image
ZywellPrinter.printPic('00:11:22:33:FF:EE', 'path/to/image.png', {
  width: 200,
  height: 200,
})
  .then(() => {
    console.log('Printed image');
  })
  .catch((error) => {
    console.error('Failed to print image', error);
  });

// Disconnect from a Bluetooth printer
ZywellPrinter.disconnectPort('00:11:22:33:FF:EE')
  .then(() => {
    console.log('Disconnected from Bluetooth printer');
  })
  .catch((error) => {
    console.error('Failed to disconnect from Bluetooth printer', error);
  });

// Disconnect from a network printer
ZywellPrinter.disconnectNet('192.168.xx.xxx')
  .then(() => {
    console.log('Disconnected from network printer');
  })
  .catch((error) => {
    console.error('Failed to disconnect from network printer', error);
  });

API

connectBLE(address: string): Promise<void>

Connect to a Bluetooth printer.

  • address: The Bluetooth address of the printer.

connectNet(ip: string): Promise<void>

Connect to a network printer.

  • ip: The IP address of the printer.

printPic(address: string, imagePath: string, options: object): Promise<void>

Print an image.

  • address: The Bluetooth address of the printer.
  • imagePath: The path to the image file.
  • options: The printing options (e.g., width, height).

disconnectPort(address: string): Promise<void>

Disconnect from a Bluetooth printer.

  • address: The Bluetooth address of the printer.

disconnectNet(ip: string): Promise<void>

Disconnect from a network printer.

  • ip: The IP address of the printer.

Please read the code in ZywellThermalPrinterPackage.java and ZywellThermalPrinter.mm for more APIs provided by the package, or you can check the Example directory.

Ex functions such as: printText, isConnect, readBuffer, clearBuffer, disconnectAll, print once, and print multiple, ...

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library