2.7.3 • Published 1 year ago

capacitor-plugin-serialprinter v2.7.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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>
ParamType
options{ port: string; }

printText(...)

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

setAlignment(...)

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

newLine()

newLine() => Promise<void>

setFontSize(...)

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

setZoom(...)

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

printGBK(...)

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

printUTF8(...)

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

setCursorPosition(...)

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

setBold(...)

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

cutPaper()

cutPaper() => Promise<void>

openCashDrawer()

openCashDrawer() => Promise<void>

printBarcode(...)

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

printQRCode(...)

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

printImage(...)

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

disconnectPrinter()

disconnectPrinter() => Promise<void>

addListener('printerStatusChanged', ...)

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

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


Interfaces

PluginListenerHandle

PropType
remove() => Promise<void>

PrinterStatus

PropType
connectedboolean

Enums

PrinterAlignment

MembersValue
LEFT1
CENTER2
RIGHT3

FontSize

MembersValue
XSMALL1
SMALL2
MEDIUM3
LARGE4

QRCodeSize

MembersValue
XSMALL100
SMALL200
MEDIUM300
LARGE400
XLARGE500
2.7.2

1 year ago

2.7.1

1 year ago

2.7.3

1 year ago

2.7.0

1 year ago