npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cap-printer-plugin

v0.0.1

Published

Capacitor printer plugin

Readme

cap-printer-plugin

Capacitor plugin for thermal printers (ESC/POS) supporting USB, Bluetooth, and Network connections.

Install

npm install cap-printer-plugin
npx cap sync

API

printText(...)

printText(options: PrintTextOptions) => Promise<void>

Print plain text

| Param | Type | Description | | ------------- | ------------------------------------------------------------- | ------------------ | | options | PrintTextOptions | Print text options |


printFormattedText(...)

printFormattedText(options: PrintFormattedTextOptions) => Promise<void>

Print formatted text with alignment, attributes, and size

| Param | Type | Description | | ------------- | ------------------------------------------------------------------------------- | ---------------------------- | | options | PrintFormattedTextOptions | Print formatted text options |


printBase64Image(...)

printBase64Image(options: PrintImageOptions) => Promise<void>

Print a base64 encoded image

| Param | Type | Description | | ------------- | --------------------------------------------------------------- | ------------------- | | options | PrintImageOptions | Print image options |


printBarcode(...)

printBarcode(options: PrintBarcodeOptions) => Promise<void>

Print a barcode

| Param | Type | Description | | ------------- | ------------------------------------------------------------------- | --------------------- | | options | PrintBarcodeOptions | Print barcode options |


printQRCode(...)

printQRCode(options: PrintQRCodeOptions) => Promise<void>

Print a QR code

| Param | Type | Description | | ------------- | ----------------------------------------------------------------- | --------------------- | | options | PrintQRCodeOptions | Print QR code options |


feedLine(...)

feedLine(options: FeedLineOptions) => Promise<void>

Feed paper by specified number of lines

| Param | Type | Description | | ------------- | ----------------------------------------------------------- | ----------------- | | options | FeedLineOptions | Feed line options |


cutPaper(...)

cutPaper(options: CutPaperOptions) => Promise<void>

Cut paper (partial cut)

| Param | Type | Description | | ------------- | ----------------------------------------------------------- | ----------------- | | options | CutPaperOptions | Cut paper options |


openCashBox(...)

openCashBox(options: OpenCashBoxOptions) => Promise<void>

Open the cash drawer

| Param | Type | Description | | ------------- | ----------------------------------------------------------------- | --------------------- | | options | OpenCashBoxOptions | Open cash box options |


printBatch(...)

printBatch(options: PrintBatchOptions) => Promise<void>

Execute multiple print operations in sequence

| Param | Type | Description | | ------------- | --------------------------------------------------------------- | ------------------- | | options | PrintBatchOptions | Batch print options |


getUsbDevices()

getUsbDevices() => Promise<GetDevicesResult>

Get list of available USB printers

Returns: Promise<GetDevicesResult>


getBluetoothDevices()

getBluetoothDevices() => Promise<GetDevicesResult>

Get list of paired Bluetooth printers Note: On Android 12+, this will automatically request Bluetooth permissions if needed

Returns: Promise<GetDevicesResult>


getPrinters()

getPrinters() => Promise<GetDevicesResult>

Get all available printers (USB and Bluetooth) Note: On Android 12+, this will automatically request Bluetooth permissions if needed

Returns: Promise<GetDevicesResult>


Interfaces

PrintTextOptions

| Prop | Type | | ------------- | --------------------------------------------------- | | printer | PrinterInfo | | text | string |

PrinterInfo

| Prop | Type | Description | | ---------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | type | ConnectionType | Connection type: 'usb', 'bluetooth', or 'network' | | id | string | Device identifier: - USB: VID:PID format (e.g., '0416:5011') or device path - Bluetooth: MAC address (e.g., '12:34:56:78:9A:BC') - Network: IP address (e.g., '192.168.1.100') |

PrintFormattedTextOptions

| Prop | Type | | --------------- | ------------------------------------------------------- | | printer | PrinterInfo | | text | string | | alignment | TextAlignment | | attribute | TextAttribute | | textSize | TextSize |

PrintImageOptions

| Prop | Type | Description | | ----------------- | ------------------------------------------------------- | ------------------------------------ | | printer | PrinterInfo | | | base64Image | string | Base64 encoded image data | | alignment | TextAlignment | | | width | number | Image width in pixels (default: 384) |

PrintBarcodeOptions

| Prop | Type | Description | | ----------------- | ------------------------------------------------------- | -------------------------------------------- | | printer | PrinterInfo | | | data | string | | | barcodeType | BarcodeType | | | alignment | TextAlignment | | | width | number | Barcode width (2-6, default: 3) | | height | number | Barcode height in dots (1-255, default: 162) |

PrintQRCodeOptions

| Prop | Type | Description | | --------------- | ------------------------------------------------------- | -------------------------------------- | | printer | PrinterInfo | | | data | string | | | size | number | QR code module size (1-16, default: 8) | | alignment | TextAlignment | |

FeedLineOptions

| Prop | Type | | ------------- | --------------------------------------------------- | | printer | PrinterInfo | | lines | number |

CutPaperOptions

| Prop | Type | | ------------- | --------------------------------------------------- | | printer | PrinterInfo |

OpenCashBoxOptions

| Prop | Type | | ------------- | --------------------------------------------------- | | printer | PrinterInfo |

PrintBatchOptions

| Prop | Type | | ------------- | --------------------------------------------------- | | printer | PrinterInfo | | items | PrintItemType[] |

GetDevicesResult

| Prop | Type | | ------------- | ------------------------- | | devices | DeviceInfo[] |

DeviceInfo

| Prop | Type | Description | | ---------- | --------------------------------------------------------- | --------------------------------------------- | | id | string | Device identifier (varies by connection type) | | name | string | Device display name | | type | ConnectionType | Connection type |

Type Aliases

ConnectionType

'usb' | 'bluetooth' | 'network'

TextAlignment

'left' | 'center' | 'right'

TextAttribute

'normal' | 'bold' | 'underline' | 'bold_underline'

TextSize

'normal' | 'wide' | 'tall' | 'large'

BarcodeType

'UPC_A' | 'UPC_E' | 'EAN8' | 'EAN13' | 'CODE39' | 'CODE93' | 'CODE128'

PrintItemType

{ type: 'text'; text: string } | { type: 'formattedText'; text: string; alignment?: TextAlignment; attribute?: TextAttribute; textSize?: TextSize } | { type: 'image'; base64Image: string; alignment?: TextAlignment; width?: number } | { type: 'barcode'; data: string; barcodeType?: BarcodeType; alignment?: TextAlignment; width?: number; height?: number } | { type: 'qrcode'; data: string; size?: number; alignment?: TextAlignment } | { type: 'feedLine'; lines: number } | { type: 'cutPaper' }

Usage Examples

Print Text to Network Printer

import { CapacitorPrinter } from 'cap-printer-plugin';

await CapacitorPrinter.printText({
  printer: { type: 'network', id: '192.168.1.100' },
  text: 'Hello, World!\n'
});

Print Formatted Receipt

await CapacitorPrinter.printFormattedText({
  printer: { type: 'network', id: '192.168.1.100' },
  text: 'RECEIPT',
  alignment: 'center',
  attribute: 'bold',
  textSize: 'large'
});

Print QR Code

await CapacitorPrinter.printQRCode({
  printer: { type: 'usb', id: '0416:5011' },
  data: 'https://example.com',
  size: 8
});

Batch Printing

await CapacitorPrinter.printBatch({
  printer: { type: 'bluetooth', id: '12:34:56:78:9A:BC' },
  items: [
    { type: 'formattedText', text: 'STORE NAME', alignment: 'center', attribute: 'bold' },
    { type: 'feedLine', lines: 1 },
    { type: 'text', text: 'Item 1         $10.00\n' },
    { type: 'text', text: 'Item 2         $15.00\n' },
    { type: 'feedLine', lines: 1 },
    { type: 'qrcode', data: 'RECEIPT-12345' },
    { type: 'cutPaper' }
  ]
});

Discover Printers

const result = await CapacitorPrinter.getPrinters();
console.log('Available printers:', result.devices);

Android Setup

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

iOS Setup

Add the following to your Info.plist:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app uses Bluetooth to connect to printers</string>
<key>NSLocalNetworkUsageDescription</key>
<string>This app uses local network to connect to network printers</string>
<key>UISupportedExternalAccessoryProtocols</key>
<array>
    <string>com.yourprotocol.printer</string>
</array>

License

MIT