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.
npm install capacitor-plugin-printer
npx cap sync
connectPrinter(...)
printText(...)
setAlignment(...)
newLine()
setFontSize(...)
setZoom(...)
printGBK(...)
printUTF8(...)
setCursorPosition(...)
setBold(...)
cutPaper()
openCashDrawer()
printBarcode(...)
printQRCode(...)
printImage(...)
disconnectPrinter()
addListener('printerStatusChanged', ...)
- Interfaces
- Enums
connectPrinter(options?: { port: string; } | undefined) => Promise<void>
Param | Type |
---|---|
options |
{ port: string; } |
printText(options: { data: string; }) => Promise<void>
Param | Type |
---|---|
options |
{ data: string; } |
setAlignment(options: { align: PrinterAlignment | number; }) => Promise<void>
Param | Type |
---|---|
options |
{ align: number; } |
newLine() => Promise<void>
setFontSize(options: { size: FontSize | number; }) => Promise<void>
Param | Type |
---|---|
options |
{ size: number; } |
setZoom(options: { zoom: number; }) => Promise<void>
Param | Type |
---|---|
options |
{ zoom: number; } |
printGBK(options: { data: string; }) => Promise<void>
Param | Type |
---|---|
options |
{ data: string; } |
printUTF8(options: { data: string; }) => Promise<void>
Param | Type |
---|---|
options |
{ data: string; } |
setCursorPosition(options: { position: number; }) => Promise<void>
Param | Type |
---|---|
options |
{ position: number; } |
setBold(options: { bold: boolean; }) => Promise<void>
Param | Type |
---|---|
options |
{ bold: boolean; } |
cutPaper() => Promise<void>
openCashDrawer() => Promise<void>
printBarcode(options: { data: string; }) => Promise<void>
Param | Type |
---|---|
options |
{ data: string; } |
printQRCode(options: { data: string; size: number | QRCodeSize; }) => Promise<void>
Param | Type |
---|---|
options |
{ data: string; size: number; } |
printImage(options: { data: string; }) => Promise<void>
Param | Type |
---|---|
options |
{ data: string; } |
disconnectPrinter() => Promise<void>
addListener(eventName: 'printerStatusChanged', listenerFunc: (status: PrinterStatus) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Param | Type |
---|---|
eventName |
'printerStatusChanged' |
listenerFunc |
(status: PrinterStatus) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Prop | Type |
---|---|
remove |
() => Promise<void> |
Prop | Type |
---|---|
connected |
boolean |
Members | Value |
---|---|
LEFT |
1 |
CENTER |
2 |
RIGHT |
3 |
Members | Value |
---|---|
XSMALL |
1 |
SMALL |
2 |
MEDIUM |
3 |
LARGE |
4 |
Members | Value |
---|---|
XSMALL |
100 |
SMALL |
200 |
MEDIUM |
300 |
LARGE |
400 |
XLARGE |
500 |