# 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 * [`requestPermissions()`](#requestpermissions) * [`scanBluetooth()`](#scanbluetooth) * [`scanUsb()`](#scanusb) * [`connectUsb()`](#connectusb) * [`scanNetwork()`](#scannetwork) * [`printBluetooth(...)`](#printbluetooth) * [`printNetwork(...)`](#printnetwork) * [`printUsb(...)`](#printusb) * [`printIntent(...)`](#printintent) * [`checkPrinterStatus(...)`](#checkprinterstatus) * [Interfaces](#interfaces) ### requestPermissions() ```typescript requestPermissions() => Promise ``` **Returns:** Promise<PermissionResult> -------------------- ### scanBluetooth() ```typescript scanBluetooth() => Promise<{ devices: PrinterDevice[]; }> ``` Scan paired Bluetooth devices **Returns:** Promise<{ devices: PrinterDevice[]; }> -------------------- ### scanUsb() ```typescript scanUsb() => Promise<{ devices: PrinterDevice[]; }> ``` Scan connected USB devices **Returns:** Promise<{ devices: PrinterDevice[]; }> -------------------- ### connectUsb() ```typescript connectUsb() => Promise ``` Connect to USB printer **Returns:** Promise<UsbConnectionResult> -------------------- ### scanNetwork() ```typescript scanNetwork() => Promise<{ devices: NetworkPrinter[]; }> ``` Scan Wi-Fi / LAN printers **Returns:** Promise<{ devices: NetworkPrinter[]; }> -------------------- ### printBluetooth(...) ```typescript printBluetooth(options: BluetoothPrintOptions) => Promise<{ success: boolean; }> ``` Print via Bluetooth SPP | Param | Type | | ------------- | ----------------------------------------------------------------------- | | **`options`** | BluetoothPrintOptions | **Returns:** Promise<{ success: boolean; }> -------------------- ### printNetwork(...) ```typescript printNetwork(options: NetworkPrintOptions) => Promise<{ success: boolean; }> ``` Print via Network/LAN/WiFi (TCP port 9100) | Param | Type | | ------------- | ------------------------------------------------------------------- | | **`options`** | NetworkPrintOptions | **Returns:** Promise<{ success: boolean; }> -------------------- ### printUsb(...) ```typescript printUsb(options: UsbPrintOptions) => Promise<{ success: boolean; }> ``` Print via USB OTG | Param | Type | | ------------- | ----------------------------------------------------------- | | **`options`** | UsbPrintOptions | **Returns:** Promise<{ success: boolean; }> -------------------- ### printIntent(...) ```typescript printIntent(options: PrintIntentOptions) => Promise ``` | Param | Type | | ------------- | ----------------------------------------------------------------- | | **`options`** | PrintIntentOptions | -------------------- ### checkPrinterStatus(...) ```typescript checkPrinterStatus(options: PrinterStatusOptions) => Promise ``` Check printer online/offline status | Param | Type | | ------------- | --------------------------------------------------------------------- | | **`options`** | PrinterStatusOptions | **Returns:** Promise<PrinterStatusResult> -------------------- ### Interfaces #### PermissionResult | Prop | Type | | --------------- | ---------------------------------------------- | | **`bluetooth`** | 'granted' \| 'denied' \| 'prompt' | | **`network`** | 'granted' \| 'denied' \| 'prompt' | #### PrinterDevice | Prop | Type | | ------------- | ------------------- | | **`name`** | string | | **`address`** | string | #### UsbConnectionResult | Prop | Type | | --------------- | -------------------- | | **`name`** | string | | **`address`** | string | | **`connected`** | boolean | #### NetworkPrinter | Prop | Type | | ------------- | ------------------- | | **`name`** | string | | **`address`** | string | | **`port`** | number | #### BluetoothPrintOptions | Prop | Type | | ------------- | --------------------- | | **`address`** | string | | **`data`** | number[] | #### NetworkPrintOptions | Prop | Type | | ---------- | --------------------- | | **`host`** | string | | **`port`** | number | | **`data`** | number[] | #### UsbPrintOptions | Prop | Type | | -------------- | --------------------- | | **`data`** | number[] | | **`deviceId`** | string | #### PrintIntentOptions | Prop | Type | | ----------------------- | ------------------- | | **`receiptText`** | string | | **`estimateText`** | string | | **`logoImage`** | string | | **`tokenDataSales`** | any[] | | **`tokenDataEstimate`** | any[] | | **`orderId`** | string | | **`estimateOrderId`** | string | | **`footerPrint`** | string | | **`upiId`** | string | | **`totalAmount`** | string | | **`estimateAmount`** | string | #### PrinterStatusResult | Prop | Type | | --------------- | ---------------------------------- | | **`connected`** | boolean | | **`status`** | 'online' \| 'offline' | | **`type`** | string | | **`address`** | string | | **`name`** | string | | **`message`** | string | #### PrinterStatusOptions | Prop | Type | | ------------- | -------------------------------------------- | | **`type`** | 'USB' \| 'Bluetooth' \| 'Wi-Fi' | | **`address`** | string |