174 lines
3.8 KiB
Markdown
174 lines
3.8 KiB
Markdown
|
|
# capacitor-pozo-printer
|
||
|
|
|
||
|
|
Capacitor plugin for Pozo Retail thermal printer integration (USB / ESC POS)
|
||
|
|
|
||
|
|
## Install
|
||
|
|
|
||
|
|
To use npm
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npm install capacitor-pozo-printer
|
||
|
|
````
|
||
|
|
|
||
|
|
To use yarn
|
||
|
|
|
||
|
|
```bash
|
||
|
|
yarn add capacitor-pozo-printer
|
||
|
|
```
|
||
|
|
|
||
|
|
Sync native files
|
||
|
|
|
||
|
|
```bash
|
||
|
|
npx cap sync
|
||
|
|
```
|
||
|
|
|
||
|
|
## API
|
||
|
|
|
||
|
|
<docgen-index>
|
||
|
|
|
||
|
|
* [`requestPermissions()`](#requestpermissions)
|
||
|
|
* [`scanBluetooth()`](#scanbluetooth)
|
||
|
|
* [`scanUsb()`](#scanusb)
|
||
|
|
* [`printBluetooth(...)`](#printbluetooth)
|
||
|
|
* [`printNetwork(...)`](#printnetwork)
|
||
|
|
* [`printUsb(...)`](#printusb)
|
||
|
|
* [Interfaces](#interfaces)
|
||
|
|
|
||
|
|
</docgen-index>
|
||
|
|
|
||
|
|
<docgen-api>
|
||
|
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
||
|
|
|
||
|
|
### requestPermissions()
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
requestPermissions() => Promise<PermissionResult>
|
||
|
|
```
|
||
|
|
|
||
|
|
**Returns:** <code>Promise<<a href="#permissionresult">PermissionResult</a>></code>
|
||
|
|
|
||
|
|
--------------------
|
||
|
|
|
||
|
|
|
||
|
|
### scanBluetooth()
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
scanBluetooth() => Promise<{ devices: PrinterDevice[]; }>
|
||
|
|
```
|
||
|
|
|
||
|
|
Scan paired Bluetooth devices
|
||
|
|
|
||
|
|
**Returns:** <code>Promise<{ devices: PrinterDevice[]; }></code>
|
||
|
|
|
||
|
|
--------------------
|
||
|
|
|
||
|
|
|
||
|
|
### scanUsb()
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
scanUsb() => Promise<{ devices: PrinterDevice[]; }>
|
||
|
|
```
|
||
|
|
|
||
|
|
Scan connected USB devices
|
||
|
|
|
||
|
|
**Returns:** <code>Promise<{ devices: PrinterDevice[]; }></code>
|
||
|
|
|
||
|
|
--------------------
|
||
|
|
|
||
|
|
|
||
|
|
### printBluetooth(...)
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
printBluetooth(options: BluetoothPrintOptions) => Promise<{ success: boolean; }>
|
||
|
|
```
|
||
|
|
|
||
|
|
Print via Bluetooth SPP
|
||
|
|
|
||
|
|
| Param | Type |
|
||
|
|
| ------------- | ----------------------------------------------------------------------- |
|
||
|
|
| **`options`** | <code><a href="#bluetoothprintoptions">BluetoothPrintOptions</a></code> |
|
||
|
|
|
||
|
|
**Returns:** <code>Promise<{ success: boolean; }></code>
|
||
|
|
|
||
|
|
--------------------
|
||
|
|
|
||
|
|
|
||
|
|
### printNetwork(...)
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
printNetwork(options: NetworkPrintOptions) => Promise<{ success: boolean; }>
|
||
|
|
```
|
||
|
|
|
||
|
|
Print via Network/LAN/WiFi (TCP port 9100)
|
||
|
|
|
||
|
|
| Param | Type |
|
||
|
|
| ------------- | ------------------------------------------------------------------- |
|
||
|
|
| **`options`** | <code><a href="#networkprintoptions">NetworkPrintOptions</a></code> |
|
||
|
|
|
||
|
|
**Returns:** <code>Promise<{ success: boolean; }></code>
|
||
|
|
|
||
|
|
--------------------
|
||
|
|
|
||
|
|
|
||
|
|
### printUsb(...)
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
printUsb(options: UsbPrintOptions) => Promise<{ success: boolean; }>
|
||
|
|
```
|
||
|
|
|
||
|
|
Print via USB OTG
|
||
|
|
|
||
|
|
| Param | Type |
|
||
|
|
| ------------- | ----------------------------------------------------------- |
|
||
|
|
| **`options`** | <code><a href="#usbprintoptions">UsbPrintOptions</a></code> |
|
||
|
|
|
||
|
|
**Returns:** <code>Promise<{ success: boolean; }></code>
|
||
|
|
|
||
|
|
--------------------
|
||
|
|
|
||
|
|
|
||
|
|
### Interfaces
|
||
|
|
|
||
|
|
|
||
|
|
#### PermissionResult
|
||
|
|
|
||
|
|
| Prop | Type |
|
||
|
|
| --------------- | ---------------------------------------------- |
|
||
|
|
| **`bluetooth`** | <code>'granted' \| 'denied' \| 'prompt'</code> |
|
||
|
|
| **`network`** | <code>'granted' \| 'denied' \| 'prompt'</code> |
|
||
|
|
|
||
|
|
|
||
|
|
#### PrinterDevice
|
||
|
|
|
||
|
|
| Prop | Type |
|
||
|
|
| ------------- | ------------------- |
|
||
|
|
| **`name`** | <code>string</code> |
|
||
|
|
| **`address`** | <code>string</code> |
|
||
|
|
|
||
|
|
|
||
|
|
#### BluetoothPrintOptions
|
||
|
|
|
||
|
|
| Prop | Type |
|
||
|
|
| ------------- | --------------------- |
|
||
|
|
| **`address`** | <code>string</code> |
|
||
|
|
| **`data`** | <code>number[]</code> |
|
||
|
|
|
||
|
|
|
||
|
|
#### NetworkPrintOptions
|
||
|
|
|
||
|
|
| Prop | Type |
|
||
|
|
| ---------- | --------------------- |
|
||
|
|
| **`host`** | <code>string</code> |
|
||
|
|
| **`port`** | <code>number</code> |
|
||
|
|
| **`data`** | <code>number[]</code> |
|
||
|
|
|
||
|
|
|
||
|
|
#### UsbPrintOptions
|
||
|
|
|
||
|
|
| Prop | Type |
|
||
|
|
| -------------- | --------------------- |
|
||
|
|
| **`data`** | <code>number[]</code> |
|
||
|
|
| **`deviceId`** | <code>string</code> |
|
||
|
|
|
||
|
|
</docgen-api>
|