All Projects → thiendangit → react-native-thermal-receipt-printer-image-qr

thiendangit / react-native-thermal-receipt-printer-image-qr

Licence: other
React native thermal receipt printer

Programming Languages

java
68154 projects - #9 most used programming language
typescript
32286 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to react-native-thermal-receipt-printer-image-qr

ESCPOS
A ESC/POS Printer Commands Helper
Stars: ✭ 26 (-63.38%)
Mutual labels:  printer, qrcode
escpos-coffee
Java library for ESC/POS printer
Stars: ✭ 172 (+142.25%)
Mutual labels:  qrcode, thermal-printer
Codeprinter
🖨️ Print out code easily
Stars: ✭ 233 (+228.17%)
Mutual labels:  printer
barcode-detector
Spec compliant polyfill of the Barcode Detection API 🤳
Stars: ✭ 31 (-56.34%)
Mutual labels:  qrcode
php-qrcode
在线生成二维码
Stars: ✭ 80 (+12.68%)
Mutual labels:  qrcode
taro-code
Taro Barcode & QRCode
Stars: ✭ 88 (+23.94%)
Mutual labels:  qrcode
react-native-qrimage-decoder
QR image decoder for React Native
Stars: ✭ 13 (-81.69%)
Mutual labels:  qrcode
Windows User Action Hook
A .NET library to subscribe for Windows operating system global user actions such mouse, keyboard, clipboard & print events
Stars: ✭ 224 (+215.49%)
Mutual labels:  printer
emv-qrcode
Golang Based EMV QR Code Generator and Parser (MPM, CPM)
Stars: ✭ 43 (-39.44%)
Mutual labels:  qrcode
kanban-board-app
Kanban style task management board app
Stars: ✭ 118 (+66.2%)
Mutual labels:  qrcode
STQRCodeController
一个简易的二维码识别控制器
Stars: ✭ 55 (-22.54%)
Mutual labels:  qrcode
qr-pirate
crawl QR-codes from search engines and look for bitcoin private keys
Stars: ✭ 58 (-18.31%)
Mutual labels:  qrcode
electron-pos-printer
Electron-pos-printer is a plugin that works to ease paper formatting and printing to thermal printers. it currently supports 80mm, 78mm, 76mm, 58mm, 57mm and 44mm printers thermal printers. it is built with Electron.js and Node.js
Stars: ✭ 198 (+178.87%)
Mutual labels:  printer
qrxfer
Transfer files from Air gapped machines using QR codes
Stars: ✭ 88 (+23.94%)
Mutual labels:  qrcode
X11docker
Run GUI applications and desktops in docker and podman containers. Focus on security.
Stars: ✭ 3,797 (+5247.89%)
Mutual labels:  printer
api2pdf.php
PHP client library for the Api2Pdf.com REST API - Convert HTML to PDF, URL to PDF, Office Docs to PDF, Merge PDFs, HTML to Image, URL to Image, HTML to Docx, HTML to Xlsx, PDF to HTML, Thumbnail preview of office files
Stars: ✭ 42 (-40.85%)
Mutual labels:  qrcode
Printooth
A well documented, high-level Android interface that makes printing via bluetooth printers easier
Stars: ✭ 231 (+225.35%)
Mutual labels:  printer
ZZYQRCode
a scanner for QRCode barCode 最好用的ios二维码、条形码,扫描、生成框架,支持闪光灯,从相册获取,扫描音效等,高仿微信,微博
Stars: ✭ 124 (+74.65%)
Mutual labels:  qrcode
Secure-QR-Reader
Privacy Focused and Secure QR Reader
Stars: ✭ 32 (-54.93%)
Mutual labels:  qrcode
next-qrcode
React hooks for generating QRCode for your next React apps.
Stars: ✭ 87 (+22.54%)
Mutual labels:  qrcode

react-native-thermal-receipt-printer-image-qr

npm npm

Implement Android IOS
Image & QR (URL & Base64) ✔️ ✔️
Fix cut ✔️ ✔️
Print With Column ✔️ ✔️
NET Connect Timeout ✔️ ✔️

Print Image & QR with bluetooth in IOS just implement not tested yet

Support

Printer Android IOS
USBPrinter ✔️
BLEPrinter ✔️ ✔️
NetPrinter ✔️ ✔️

bill screenshot

Installation

npm i react-native-thermal-receipt-printer-image-qr
npm i react-native-ping

or

yarn add react-native-thermal-receipt-printer-image-qr
yarn add react-native-ping

next step

# RN >= 0.60
cd ios && pod install

# RN < 0.60
react-native link react-native-thermal-receipt-printer-image-qr

API Reference

    init: () => Promise;
    getDeviceList: () => Promise;
    /**
     * `timeout`
     * @default 4000ms
     */
    connectPrinter: (host: string, port: number, timeout?: number | undefined) => Promise;
    closeConn: () => Promise;
    /**
     * Print text
     */
    printText: (text: string, opts?: {}) => void;
    /**
     * Print text & end the bill & cut
     */
    printBill: (text: string, opts?: PrinterOptions) => void;
    /**
     * print with image url
     */
    printImage: (imgUrl: string, opts?: PrinterImageOptions) => void;
    /**
     * Base 64 string
     */
    printImageBase64: (Base64: string, opts?: PrinterImageOptions) => void;
    /**
     * Only android print with encoder
     */
    printRaw: (text: string) => void;
    /**
     * print column
     * 80mm => 46 character
     * 58mm => 30 character
     */
    printColumnsText: (texts: string[], columnWidth: number[], columnAlignment: ColumnAlignment[], columnStyle?: string[], opts?: PrinterOptions) => void;

Styling

import {
  COMMANDS,
  ColumnAlignment,
} from "react-native-thermal-receipt-printer-image-qr";

See more here

Example

Print Columns Text

const BOLD_ON = COMMANDS.TEXT_FORMAT.TXT_BOLD_ON;
const BOLD_OFF = COMMANDS.TEXT_FORMAT.TXT_BOLD_OFF;
let orderList = [
  ["1. Skirt Palas Labuh Muslimah Fashion", "x2", "500$"],
  ["2. BLOUSE ROPOL VIRAL MUSLIMAH FASHION", "x4222", "500$"],
  [
    "3. Women Crew Neck Button Down Ruffle Collar Loose Blouse",
    "x1",
    "30000000000000$",
  ],
  ["4. Retro Buttons Up Full Sleeve Loose", "x10", "200$"],
  ["5. Retro Buttons Up", "x10", "200$"],
];
let columnAlignment = [
  ColumnAlignment.LEFT,
  ColumnAlignment.CENTER,
  ColumnAlignment.RIGHT,
];
let columnWidth = [46 - (7 + 12), 7, 12];
const header = ["Product list", "Qty", "Price"];
Printer.printColumnsText(header, columnWidth, columnAlignment, [
  `${BOLD_ON}`,
  "",
  "",
]);
for (let i in orderList) {
  Printer.printColumnsText(orderList[i], columnWidth, columnAlignment, [
    `${BOLD_OFF}`,
    "",
    "",
  ]);
}
Printer.printBill(`${CENTER}Thank you\n`);

Print image

Printer.printImage(
  "https://media-cdn.tripadvisor.com/media/photo-m/1280/1b/3a/bd/b5/the-food-bill.jpg",
  {
    imageWidth: 575,
    // imageHeight: 1000,
    // paddingX: 100
  }
);

See more here

Troubleshoot

  • When installing react-native version >= 0.60, XCode shows this error:
duplicate symbols for architecture x86_64

That's because the .a library uses CocoaAsyncSocket library and Flipper uses it too.

Podfile

...
  use_native_modules!

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # add_flipper_pods!
  # post_install do |installer|
  #   flipper_post_install(installer)
  # end
...

and comment out code related to Flipper in ios/AppDelegate.m

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].