Bluetooth printer support for Capacitor
npm install @public-js/bluetooth-printer-zjBluetooth printer support for Capacitor
``bash`
npm install @public-js/bluetooth-printer-zj
npx cap sync
* discover()
* connect(...)
* disconnect()
* print(...)
* Interfaces
* Type Aliases
`typescript`
discover() => Promise
Returns: Promise<DiscoverResponse>
--------------------
`typescript`
connect(data: ConnectRequest) => Promise
| Param | Type |
| ---------- | --------------------------------------------------------- |
| data | ConnectRequest |
Returns: Promise<ConnectResponse>
--------------------
`typescript`
disconnect() => Promise
--------------------
`typescript`
print(data: PrintRequest) => Promise
| Param | Type |
| ---------- | ----------------------------------------------------- |
| data | PrintRequest |
--------------------
#### DiscoverResponse
| Prop | Type |
| ------------- | ------------------------------- |
| devices | DiscoveredDevice[] |
#### DiscoveredDevice
| Prop | Type |
| ------------- | -------------------- |
| address | string |
| name | string |
| bonded | boolean |
#### ConnectResponse
| Prop | Type |
| ------------ | ------------------- |
| device | string |
#### ConnectRequest
| Prop | Type |
| ------------- | ------------------- |
| address | string |
#### PrintRequest
| Prop | Type |
| --------------- | ------------------------- |
| blocks | PrintBlock[] |
| pageWidth | number |
| feed | number |
#### PrintBlock
| Prop | Type | Default |
| ---------- | --------------------------------------------------------- | --------------- |
| type | PrintBlockType | lf |
#### PrintBlockLf
| Prop | Type |
| ---------- | ----------------- |
| type | 'lf' |
#### PrintBlockTextRaw
| Prop | Type | Default |
| ----------------- | ---------------------- | ---------------- |
| type | 'textRaw' | |
| encoding | string | GBK |
| codepage | number | 0 |
| scaleWidth | number | 0 |
| scaleHeight | number | 0 |
| fontStyle | number | 0 |
| align | number | 0 |
#### PrintBlockTextDraw
| Prop | Type | Default |
| --------------- | ----------------------- | --------------- |
| type | 'textDraw' | |
| lineCount | number | |
| fontSize | number | 16 |
| mode | number | 0 |
#### PrintBlockTextQr
| Prop | Type | Default |
| --------------- | --------------------- | -------------- |
| type | 'textQr' | |
| codeWidth | number | |
| mode` | number | 0 |
#### PrintBlockType
'lf' | 'textRaw' | 'textDraw' | 'textQr'
#### PrintBlock
PrintBlockLf | PrintBlockTextRaw | PrintBlockTextDraw | PrintBlockTextQr