0.1.6 • Published 2 years ago

react-native-xprinter-thermal v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-native-xprinter-thermal

Portable xprinter sdk for react native android only

Installation

yarn add react-native-xprinter-thermal

Add service to AndroidManifest.xml

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <!-- Add service below -->
      <service android:name="net.posprinter.service.PosprinterService" >
      </service>
      <!-- End -->
    </application>

Usage

import { XprinterThermal } from "react-native-xprinter-thermal";

// ...

// Interface for xprinter module
interface IXprinterThermal {
  connectNet: (ip: string, port: number) => Promise<void>;
  disconnectNet: () => Promise<void>;
  setLabelSize: (height: number, width: number) => void;
  setLabelGap: (vertical: number, horizontal: number) => void;
  addPrintText: (
    x: number,
    y: number,
    font: string,
    rotation: number,
    xMultiplication: number,
    yMultiplication: number,
    content: string
  ) => void;
  addPrintBarcode: (
    x: number,
    y: number,
    codeType: string,
    height: number,
    human: number,
    rotation: number,
    narrow: number,
    wide: number,
    content: string
  ) => void;
  addPrintQRcode: (
    x: number,
    y: number,
    eccLevel: string,
    cellWidth: number,
    mode: string,
    rotation: number,
    model: string,
    mask: string,
    content: string
  ) => void;
  print: () => Promise<string>;
}

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

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago