capacitor-pozo-printer/README.md

289 lines
7.2 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)
2026-07-01 11:57:40 +05:30
* [`connectUsb()`](#connectusb)
* [`scanNetwork()`](#scannetwork)
2026-03-18 09:43:44 +05:30
* [`printBluetooth(...)`](#printbluetooth)
* [`printNetwork(...)`](#printnetwork)
* [`printUsb(...)`](#printusb)
2026-07-01 11:57:40 +05:30
* [`printIntent(...)`](#printintent)
* [`checkPrinterStatus(...)`](#checkprinterstatus)
2026-03-18 09:43:44 +05:30
* [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>
--------------------
2026-07-01 11:57:40 +05:30
### connectUsb()
```typescript
connectUsb() => Promise<UsbConnectionResult>
```
Connect to USB printer
**Returns:** <code>Promise&lt;<a href="#usbconnectionresult">UsbConnectionResult</a>&gt;</code>
--------------------
### scanNetwork()
```typescript
scanNetwork() => Promise<{ devices: NetworkPrinter[]; }>
```
Scan Wi-Fi / LAN printers
**Returns:** <code>Promise&lt;{ devices: NetworkPrinter[]; }&gt;</code>
--------------------
2026-03-18 09:43:44 +05:30
### 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>
--------------------
2026-07-01 11:57:40 +05:30
### printIntent(...)
```typescript
printIntent(options: PrintIntentOptions) => Promise<void>
```
| Param | Type |
| ------------- | ----------------------------------------------------------------- |
| **`options`** | <code><a href="#printintentoptions">PrintIntentOptions</a></code> |
--------------------
### checkPrinterStatus(...)
```typescript
checkPrinterStatus(options: PrinterStatusOptions) => Promise<PrinterStatusResult>
```
Check printer online/offline status
| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| **`options`** | <code><a href="#printerstatusoptions">PrinterStatusOptions</a></code> |
**Returns:** <code>Promise&lt;<a href="#printerstatusresult">PrinterStatusResult</a>&gt;</code>
--------------------
2026-03-18 09:43:44 +05:30
### 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> |
2026-07-01 11:57:40 +05:30
#### UsbConnectionResult
| Prop | Type |
| --------------- | -------------------- |
| **`name`** | <code>string</code> |
| **`address`** | <code>string</code> |
| **`connected`** | <code>boolean</code> |
#### NetworkPrinter
| Prop | Type |
| ------------- | ------------------- |
| **`name`** | <code>string</code> |
| **`address`** | <code>string</code> |
| **`port`** | <code>number</code> |
2026-03-18 09:43:44 +05:30
#### 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> |
2026-07-01 11:57:40 +05:30
#### PrintIntentOptions
| Prop | Type |
| ----------------------- | ------------------- |
| **`receiptText`** | <code>string</code> |
| **`estimateText`** | <code>string</code> |
| **`logoImage`** | <code>string</code> |
| **`tokenDataSales`** | <code>any[]</code> |
| **`tokenDataEstimate`** | <code>any[]</code> |
| **`orderId`** | <code>string</code> |
| **`estimateOrderId`** | <code>string</code> |
| **`footerPrint`** | <code>string</code> |
| **`upiId`** | <code>string</code> |
| **`totalAmount`** | <code>string</code> |
| **`estimateAmount`** | <code>string</code> |
#### PrinterStatusResult
| Prop | Type |
| --------------- | ---------------------------------- |
| **`connected`** | <code>boolean</code> |
| **`status`** | <code>'online' \| 'offline'</code> |
| **`type`** | <code>string</code> |
| **`address`** | <code>string</code> |
| **`name`** | <code>string</code> |
| **`message`** | <code>string</code> |
#### PrinterStatusOptions
| Prop | Type |
| ------------- | -------------------------------------------- |
| **`type`** | <code>'USB' \| 'Bluetooth' \| 'Wi-Fi'</code> |
| **`address`** | <code>string</code> |
2026-03-18 09:43:44 +05:30
</docgen-api>