2.0.3 • Published 4 months ago

@ticketplushq/capacitor-pos-pax-printer-utility v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@ticketplushq/capacitor-pos-pax-printer-utility

Printer integration for PAX payment POS, Android support.

In web context it behaves like a mock that returns successful execution results.

When executed in the emulator or on a device other than the POS, it will generate an error that will stop the application. This is due to the lack of installation of the NeptuneService app. At the moment, it has not been possible to install NeptuneService on a device other than POS but work is being done to achieve it.

Permissions

Adding permissions in the AndroidManifest.xml file

<uses-permission android:name="com.pax.permission.PRINTER"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Install

npm install @ticketplushq/capacitor-pos-pax-printer-utility
npx cap sync

API

init()

init() => Promise<{ ok: boolean; }>

Get printer and init instance

Returns: Promise<{ ok: boolean; }>


start()

start() => Promise<StatusResp>

Run printer commands

Returns: Promise<StatusResp>


printStr(...)

printStr({ text }: PrintStrArgs) => Promise<void>

Print text string

ParamTypeDescription
__0PrintStrArgs<{text: string, charset: string}>

printBase64Image(...)

printBase64Image({ image }: PrintBase64ImageArgs) => Promise<StatusResp>

Print base64 image (jpg) (in development)

ParamTypeDescription
__0PrintBase64ImageArgs<{image: string}>

Returns: Promise<StatusResp>


printReceipt(...)

printReceipt({ text }: PrintReceiptArgs) => Promise<StatusResp>

Print receipt only

ParamTypeDescription
__0PrintReceiptArgs<{text: string, asciiFontType?:EFontTypeAscii, cFontType?: EFontTypeExtCode}>

Returns: Promise<StatusResp>


printReceiptWithQr(...)

printReceiptWithQr({ text, qrString, }: PrintReceiptWithQrArgs) => Promise<StatusResp>

Print receipt and QR code content

ParamTypeDescription
__0PrintReceiptWithQrArgs<{text: string, qrString: string, asciiFontType?:EFontTypeAscii, cFontType?: EFontTypeExtCode}>

Returns: Promise<StatusResp>


printQR(...)

printQR({ text, qrString, startText, endText, }: PrintQrArgs) => Promise<StatusResp>

Print QR code content, optionally you can pass a text to print before (startText) and after (endText) the QR code, the content of the text argument is printed before startText and with the size of endText

ParamTypeDescription
__0PrintQrArgs<{text: string, qrString: string, startText?:string, endText?: string, asciiFontType?:EFontTypeAscii, cFontType?: EFontTypeExtCode}>

Returns: Promise<StatusResp>


cutPaper(...)

cutPaper({ mode }: CutPaperMode) => Promise<{ ok: boolean; }>

Set printer cut mode, remember that to use this method you must before started the printer instance,

ParamTypeDescription
__0CutPaperMode<{mode: number}>

Returns: Promise<{ ok: boolean; }>


getCutMode()

getCutMode() => Promise<CutPaperMode>

Get printer cut mode, remember that to use this method you must before started the printer instance,

Returns: Promise<CutPaperMode>


getStatus()

getStatus() => Promise<StatusResp>

Get printer status, remember that to use this method you must before started the printer instance,

Returns: Promise<StatusResp>


fontSet(...)

fontSet(asciiFontType: EFontTypeAscii, cFontType: EFontTypeExtCode) => Promise<void>

Set print font

ParamTypeDescription
asciiFontTypeEFontTypeAsciiEFontTypeAscii
cFontTypeEFontTypeExtCodeEFontTypeExtCode

doubleHeight(...)

doubleHeight(isAscDouble: boolean, isLocalDouble: boolean) => Promise<void>

Set printing font which is based on base font to double height.

ParamTypeDescription
isAscDoublebooleanIf the single coding font is double height or not.
isLocalDoublebooleanIf the multi coding font is double height or not.

doubleWidth(...)

doubleWidth(isAscDouble: boolean, isLocalDouble: boolean) => Promise<void>

Set printing font which is based on base font to double width.

ParamTypeDescription
isAscDoublebooleanIf the single coding font is double width or not.
isLocalDoublebooleanIf the multi coding font is double width or not.

Interfaces

StatusResp

PropType
statusStatusCodes

PrintStrArgs

PropType
textstring

PrintBase64ImageArgs

PropType
imagestring

PrintReceiptArgs

PropType
textstring

PrintReceiptWithQrArgs

PropType
textstring
qrStringstring | null

PrintQrArgs

PropType
textstring | null
qrStringstring | null
startTextstring | null
endTextstring | null
asciiFontTypeEndEFontTypeAscii | null
cFontTypeEndEFontTypeExtCode | null

CutPaperMode

PropType
modeCutMode

Type Aliases

StatusCodes

ValueDescription
0Success
1Printer is busy
2Out of paper
3The format of print data packet error
4Printer malfunctions
8Printer over heats
9Printer voltage is too low
-16Printing is unfinished
-6cut jam error(only support:E500,E800)
-5cover open error(only support:E500,E800,SK600,SK800)
-4The printer has not installed font library
-2Data package is too long

0 | 1 | 2 | 3 | 4 | 8 | 9 | -16 | -6 | -5 | -4 | -2

CutMode

ValueDescription
0FULL_PAPER_CUTTING
1PARTIAL_PAPER_CUTTING
2FULL_AND_PARTIAL_PAPER_CUTTING
-1NO_CUTTING_KNIFE_NOT_SUPPORTED

0 | 1 | 2 | -1

Enums

EFontTypeAscii

MembersValueDescription
FONT_8_16'FONT_8_16'8x16 font (Basic)
FONT_12_24'FONT_12_24'12x24 font (Basic)
FONT_8_32'FONT_8_32'8x16 font (enlarge vertically)
FONT_12_48'FONT_12_48'12x24 font (enlarge vertically)
FONT_16_16'FONT_16_16'8x16 font (enlarge horizontally)
FONT_24_24'FONT_24_24'12x24 font (enlarge horizontally)
FONT_16_32'FONT_16_32'8x16 font (enlarge on both levels)
FONT_24_48'FONT_24_48'12x24 font (enlarge on both levels)

EFontTypeExtCode

MembersValueDescription
FONT_16_16'FONT_16_16'16x16 font (Basic)
FONT_24_24'FONT_24_24'24x24 font (Basic)
FONT_16_32'FONT_16_32'16x16 font (enlarge vertically)
FONT_24_48'FONT_24_48'24x24 font (enlarge vertically)
FONT_32_16'FONT_32_16'16x16 font (enlarge horizontally)
FONT_48_24'FONT_48_24'24x24 font (enlarge horizontally)
FONT_32_32'FONT_32_32'16x16 font (enlarge on both levels)
FONT_48_48'FONT_48_48'24x24 font (enlarge on both levels)
2.0.3

4 months ago

2.0.2

8 months ago

2.0.1

8 months ago

2.0.0

11 months ago

1.1.0

1 year ago

1.0.1

1 year ago