capacitor-pozo-printer/README.md

174 lines
3.8 KiB
Markdown
Raw Normal View History

2026-03-18 09:43:44 +05:30
# 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&lt;<a href="#permissionresult">PermissionResult</a>&gt;</code>
--------------------
### scanBluetooth()
```typescript
scanBluetooth() => Promise<{ devices: PrinterDevice[]; }>
```
Scan paired Bluetooth devices
**Returns:** <code>Promise&lt;{ devices: PrinterDevice[]; }&gt;</code>
--------------------
### scanUsb()
```typescript
scanUsb() => Promise<{ devices: PrinterDevice[]; }>
```
Scan connected USB devices
**Returns:** <code>Promise&lt;{ devices: PrinterDevice[]; }&gt;</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&lt;{ success: boolean; }&gt;</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&lt;{ success: boolean; }&gt;</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&lt;{ success: boolean; }&gt;</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>