capacitor-plugin-epson-epos
v0.0.21
Published
A capacitorjs plugin for Epson Pos Printer
Readme
capacitor-plugin-epson-epos
A capacitorjs plugin for Epson Pos Printer
Android
- ePos SDK: V2.29.0.a
- Only tested with TM_T20III Ethernet / TM_T20 USB
Roadmap
- Add iOS support
Install
npm install capacitor-plugin-epson-epos
npx cap syncHow to use
API
requestPermission()startDiscovery(...)stopDiscovery()print(...)finalizePrinter()- Interfaces
- Type Aliases
requestPermission()
requestPermission() => Promise<{ success: boolean; }>Returns: Promise<{ success: boolean; }>
startDiscovery(...)
startDiscovery(options: DiscoveryOptions) => Promise<DiscoveryResult>| Param | Type |
| ------------- | ------------------------------------------------------------- |
| options | DiscoveryOptions |
Returns: Promise<DiscoveryResult>
stopDiscovery()
stopDiscovery() => Promise<{ message: string; }>Returns: Promise<{ message: string; }>
print(...)
print(options: PrintOptions) => Promise<{ success: boolean; }>| Param | Type |
| ------------- | ----------------------------------------------------- |
| options | PrintOptions |
Returns: Promise<{ success: boolean; }>
finalizePrinter()
finalizePrinter() => Promise<{ message: string; }>Returns: Promise<{ message: string; }>
Interfaces
DiscoveryResult
| Prop | Type |
| -------------- | ------------------------------------- |
| printers | DiscoveryResultPrinter[] |
DiscoveryResultPrinter
| Prop | Type |
| ----------------- | ------------------- |
| PrinterName | string |
| Target | string |
DiscoveryOptions
| Prop | Type | Default |
| --------------- | --------------------------------------------------------------- | --------------------------------- |
| timeout | number | 10000 (milliseconds) |
| broadcast | string | '255.255.255.255' |
| portType | EpsonEposPortType | 'ALL' |
PrintOptions
| Prop | Type | Default |
| ------------------ | ----------------------------------------------------------------------- | ------------------ |
| target | string | |
| instructions | PrintInstruction[] | |
| modelCode | EpsonEposPrinterSerie | |
| langCode | string | 'ANK' |
PrintInstruction
| Prop | Type | Description |
| --------------------- | --------------------------------------------------------------------------------------------------------- | ----------------------- |
| addHPosition | number | Integer from 0 to 65535 |
| addLineSpace | number | Integer from 0 to 255 |
| addFeedLine | number | Integer from 0 to 255 |
| addFeedUnit | number | Integer from 0 to 255 |
| addTextAlign | TextAlign | |
| addText | PrintText | |
| addTextStyle | PrintTextStyle | |
| addBase64Image | PrintBase64Image | |
| addBarcode | PrintBarcode | |
| addSymbol | PrintSymbol | |
| addTextSize | [number, number] | |
| addHLine | PrintHorizontalLine | |
| addVLineBegin | PrintVerticalLine | |
| addVLineEnd | Pick<PrintVerticalLine, 'lineId'> | |
| addCut | Cut | |
| addPulse | PrintWithPulse | |
| addCommand | BinaryType | |
| addFeedPosition | FeedPosition | |
| addLayout | PrintLayout | |
PrintText
| Prop | Type |
| ----------- | --------------------------------------------------------- |
| value | string | string[] |
| size | [number, number] |
| align | TextAlign |
| style | PrintTextStyle |
PrintTextStyle
| Prop | Type | Default |
| ------------- | -------------------- | ------------------ |
| reverse | boolean | false |
| ul | boolean | false |
| em | boolean | false |
PrintBase64Image
| Prop | Type | Description | Default |
| ---------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| value | string | Base64 image string | |
| x | number | | |
| y | number | | |
| width | number | Specifies the width of the print area (in pixels). | |
| height | number | Specifies the height of the print area (in pixels). | |
| color | ImageColor | Specifies the color. | COLOR_1 |
| mode | ImageMode | Specifies the mode. | MONO |
| compress | ImageHalfTone | Enables or disables compression. Compressing print images can prevent white banding or streaks from occurring on printed images. This works well when connecting with the printer using Bluetooth. | AUTO |
| halftone | ImageHalfTone | Specifies the halftone | |
| brightness | number | Specifies the brightness compensation value. | 1 |
PrintBarcode
| Prop | Type | Default |
| ------------ | --------------------------------------------------- | -------------------------------------- |
| value | string | |
| type | BarcodeType | CODE_39 |
| font | BarcodeFont | FONT_A |
| hri | BarcodeHri | HRI_BELOW |
| width | number | 2 Integer from 2 to 6 |
| height | number | 100 Integer from 1 to 255 |
PrintSymbol
| Prop | Type | Description | Default |
| ------------ | ------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ------------------------------- |
| value | string | | |
| type | SymbolType | | |
| level | number | SymbolLevelPDF | SymbolLevelQRCode | | |
| width | number | The range differs depending on the 2D symbol type. | PDF417 from 2 to 8 |
| height | number | The range differs depending on the 2D symbol type. | PDF417 from 2 to 8 |
| size | number | The range differs depending on the 2D symbol type. | PDF417 0 |
PrintHorizontalLine
| Prop | Type |
| --------------- | ----------------------------------------------- |
| position | [number, number] |
| lineStyle | LineStyle |
PrintVerticalLine
| Prop | Type |
| --------------- | ----------------------------------------------- |
| position | number |
| lineStyle | LineStyle |
| lineId | number[] |
PrintWithPulse
| Prop | Type | Default |
| ------------ | ----------------------------------------------- | ----------------- |
| drawer | DrawerPin | 2pin |
| time | PulseTime | 100 |
PrintLayout
| Prop | Type |
| ------------------ | ------------------------------------------------- |
| type | LayoutType |
| width | number |
| height | number |
| marginTop | number |
| marginBottom | number |
| offsetCut | number |
| offsetLabel | number |
Type Aliases
EpsonEposPortType
'ALL' | 'TCP' | 'BLUETOOTH' | 'USB'
TextAlign
'left' | 'right' | 'center'
ImageColor
'COLOR_1' | 'COLOR_2' | 'COLOR_3' | 'COLOR_4' | 'COLOR_NONE'
ImageMode
'MONO' | 'GRAY16' | 'HIGH_DENSITY'
ImageHalfTone
'DITHER' | 'THRESHOLD' | 'ERROR_DIFFUSION'
BarcodeType
Types representing the allowed barcode types.
'UPC_A' | 'UPC_E' | 'EAN13' | 'JAN13' | 'EAN8' | 'JAN8' | 'ITF' | 'CODA_BAR' | 'CODE_39' | 'CODE_93' | 'CODE_128' | 'CODE_128_AUTO' | 'GS1_128' | 'GS1_DATA_BAR_OMNIDIRECTIONAL' | 'GS1_DATA_BAR_TRUNCATED' | 'GS1_DATA_BAR_LIMITED' | 'GS1_DATA_BAR_EXPANDED'
BarcodeFont
Types representing the allowed barcode fonts.
'FONT_A' | 'FONT_B' | 'FONT_C' | 'FONT_D' | 'FONT_E'
BarcodeHri
Types representing the allowed barcode HRI (Human Readable Interpretation) positions.
'HRI_NONE' | 'HRI_ABOVE' | 'HRI_BELOW' | 'HRI_BOTH'
SymbolType
'PDF417_TRUNCATED' | 'QRCODE_MODEL_1' | 'QRCODE_MODEL_2' | 'QRCODE_MICRO' | 'MAXICODE_MODE_2' | 'MAXICODE_MODE_3' | 'MAXICODE_MODE_4' | 'MAXICODE_MODE_5' | 'MAXICODE_MODE_6' | 'GS1_DATABAR_STACKED' | 'GS1_DATABAR_STACKED_OMNIDIRECTIONAL' | 'GS1_DATABAR_EXPANDED_STACKED' | 'AZTECCODE_FULLRANGE' | 'AZTECCODE_COMPACT' | 'DATAMATRIX_SQUARE' | 'DATAMATRIX_RECTANGLE_8' | 'DATAMATRIX_RECTANGLE_12' | 'DATAMATRIX_RECTANGLE_16'
SymbolLevelPDF
'LEVEL_0' | 'LEVEL_1' | 'LEVEL_2' | 'LEVEL_3' | 'LEVEL_4' | 'LEVEL_5' | 'LEVEL_6' | 'LEVEL_7' | 'LEVEL_8'
SymbolLevelQRCode
'LEVEL_L' | 'LEVEL_M' | 'LEVEL_Q' | 'LEVEL_H'
SymbolLevelAztecCode
number
LineStyle
'thin' | 'medium' | 'thick' | 'thin_double' | 'medium_double' | 'thick_double'
Pick
From T, pick a set of properties whose keys are in the union K
{ [P in K]: T[P]; }
Cut
'cut_feed' | 'cut_no_feed' | 'cut_reserve' | 'full_cut_feed' | 'full_cut_no_feed' | 'full_cut_reserve'
DrawerPin
'2pin' | '5pin'
PulseTime
'pulse_100' | 'pulse_200' | 'pulse_300' | 'pulse_300' | 'pulse_400' | 'pulse_500'
FeedPosition
'peeling' | 'cutting' | 'current_tof' | 'next_tof'
LayoutType
'receipt' | 'receipt_bm' | 'label' | 'label_bm'
EpsonEposPrinterSerie
'TM_M10' | 'TM_M30' | 'TM_P20' | 'TM_P60' | 'TM_P60II' | 'TM_P80' | 'TM_T20' | 'TM_T60' | 'TM_T70' | 'TM_T81' | 'TM_T82' | 'TM_T83' | 'TM_T83III' | 'TM_T88' | 'TM_T90' | 'TM_T90KP' | 'TM_T100' | 'TM_U220' | 'TM_U330' | 'TM_L90' | 'TM_H6000' | 'TM_M30II' | 'TS_100' | 'TM_M50' | 'TM_T88VII' | 'TM_L90LFC' | 'EU_M30' | 'TM_L100' | 'TM_P20II' | 'TM_P80II' | 'TM_M30III' | 'TM_M50II' | 'TM_M55' | 'TM_U220II'
