capacitor-plugin-serialprinter
TypeScript icon, indicating that this package has built-in type declarations

2.7.3 • Public • Published

capacitor-plugin-serialprinter

Printer Plugin for Citaq H10

This plugin is used to print text, barcode, qrcode, image on Citaq H10 printer. It may also work on other printers that support ESC/POS commands.

You can specify the port to connect to the printer. If you don't specify the port, the plugin will try to connect to /dev/ttyS1.

Please bare in mind that this plugin may be unstable. There are a few unhandled exceptions that may cause the app to crash.
I will try to fix them in the future. For best stability, please follow the typescript definitions.

This will only work on Android. It was not developed for iOS or the web as these platforms do not support serial ports.

Install

npm install capacitor-plugin-printer
npx cap sync

API

connectPrinter(...)

connectPrinter(options?: { port: string; } | undefined) => Promise<void>
Param Type
options { port: string; }

printText(...)

printText(options: { data: string; }) => Promise<void>
Param Type
options { data: string; }

setAlignment(...)

setAlignment(options: { align: PrinterAlignment | number; }) => Promise<void>
Param Type
options { align: number; }

newLine()

newLine() => Promise<void>

setFontSize(...)

setFontSize(options: { size: FontSize | number; }) => Promise<void>
Param Type
options { size: number; }

setZoom(...)

setZoom(options: { zoom: number; }) => Promise<void>
Param Type
options { zoom: number; }

printGBK(...)

printGBK(options: { data: string; }) => Promise<void>
Param Type
options { data: string; }

printUTF8(...)

printUTF8(options: { data: string; }) => Promise<void>
Param Type
options { data: string; }

setCursorPosition(...)

setCursorPosition(options: { position: number; }) => Promise<void>
Param Type
options { position: number; }

setBold(...)

setBold(options: { bold: boolean; }) => Promise<void>
Param Type
options { bold: boolean; }

cutPaper()

cutPaper() => Promise<void>

openCashDrawer()

openCashDrawer() => Promise<void>

printBarcode(...)

printBarcode(options: { data: string; }) => Promise<void>
Param Type
options { data: string; }

printQRCode(...)

printQRCode(options: { data: string; size: number | QRCodeSize; }) => Promise<void>
Param Type
options { data: string; size: number; }

printImage(...)

printImage(options: { data: string; }) => Promise<void>
Param Type
options { data: string; }

disconnectPrinter()

disconnectPrinter() => Promise<void>

addListener('printerStatusChanged', ...)

addListener(eventName: 'printerStatusChanged', listenerFunc: (status: PrinterStatus) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param Type
eventName 'printerStatusChanged'
listenerFunc (status: PrinterStatus) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

PluginListenerHandle

Prop Type
remove () => Promise<void>

PrinterStatus

Prop Type
connected boolean

Enums

PrinterAlignment

Members Value
LEFT 1
CENTER 2
RIGHT 3

FontSize

Members Value
XSMALL 1
SMALL 2
MEDIUM 3
LARGE 4

QRCodeSize

Members Value
XSMALL 100
SMALL 200
MEDIUM 300
LARGE 400
XLARGE 500

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.7.31latest

Version History

VersionDownloads (Last 7 Days)Published
2.7.31
2.7.20
2.7.10
2.7.00

Package Sidebar

Install

npm i capacitor-plugin-serialprinter

Weekly Downloads

1

Version

2.7.3

License

MIT

Unpacked Size

56.1 kB

Total Files

24

Last publish

Collaborators

  • realashleybailey