This is a new React Native project, bootstrapped using @react-native-community/cli
.
Getting Started
Note: Make sure you have completed the React Native - Environment Setup instructions till "Creating a new application" step, before proceeding.
Step 1: Installation
npm install react-native-ezprinter --save
or
yarn add react-native-ezprinter
Step 2: Add dependenceie
- modify app/build.gradle under the android project:
implementation project(':react-native-ezprinter')
Step 3: Add 'EzPrinterPackage' to MainApplication
import com.goodcom.react.EzPrinter.EzPrinterPackage;
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new EzPrinterPackage()
);
Step 4: Import in React-Native
import EzPrinter, {FontSize, AlignmentType, BarcodeType} from 'react-native-ezprinter';
API
Constants
FontSize : font size
AlignmentType : Alignment Type
BarcodeType : Barcode Type
Type | Sub type |
---|
FontSize | Default,Small,Medium,Big,DoubleHeight,DoubleWidth,SmallBold,MediumBold,BigBold,DoubleHeightBold,DoubleWidthBold |
AlignmentType | Left,Center,Right |
BarcodeType | barcodeUpca,barcodeUpce,barcodeEan8,barcodeEan13,barcodeCode128,barcodeCode39,barcodeCodeBar,barcodeItf,barcodeCode93,barcodeQrCode |
Method
Method | Parameter | Return Type |
---|
drawText | strLeft, fontLeft, strMid, fontMid, strRight, fontRight | void |
printText | isAutoFeed | void |
drawLeftRight | strLeft, fontLeft, strRight, fontRight | void |
drawCustom | string, fontSize, align | void |
drawNewLine | | void |
drawOneLine | fontSize | void |
drawOneLineDefault | | void |
drawBarcode | str, align, type | void |
drawBarcodeWithHeight | string, align, type, height | void |
drawQrCode | string, align | void |
drawQrCodeWithHeight | string,align,height | void |
isDeviceSupport | | Promise<number> |
printJson | json | void |
printImageByBase64 | base64, align, isAutoFeed | void |
printImageByArray | byteArray, align, isAutoFeed | void |
drawText: (strLeft, fontLeft, strMid, fontMid, strRight, fontRight) => void,
printText: (isAutoFeed) => void,
drawLeftRight: (strLeft, fontLeft, strRight, fontRight) => void,
drawCustom: (string, fontSize, align) => void,
drawNewLine: () => void,
drawOneLine: (fontSize) => void,
drawOneLineDefault: () => void,
drawBarcode: (str, align, type) => void,
drawBarcodeWithHeight: (string, align, type, height) => void,
drawQrCode: (string, align) => void;
drawQrCodeWithHeight: (string,align,height) => void;
isDeviceSupport: () => Promise<string>,
printJson: (json) => void,
printImageByBase64: (base64, align, isAutoFeed) => void,