API
printImage(...)search(...)isChannelAvailable(...)cancelSearchWiFiPrinter()cancelSearchBluetoothPrinter()addListener(BrotherPrintEventsEnum.onPrinterAvailable, ...)addListener(BrotherPrintEventsEnum.onPrint, ...)addListener(BrotherPrintEventsEnum.onPrintFailedCommunication, ...)addListener(BrotherPrintEventsEnum.onPrintError, ...)- Interfaces
- Type Aliases
- Enums
method printImage(...)
printImage(options: BRLMPrintOptions) => Promise<void>
| Param | Type |
|---|---|
options |
<code><a href="#brlmprintoptions">BRLMPrintOptions</a></code> |
method search(...)
search(option: BRLMSearchOption) => Promise<void>
Search for printers. If not found, it will return an empty array.(not error)
| Param | Type |
|---|---|
option |
<code><a href="#brlmsearchoption">BRLMSearchOption</a></code> |
method isChannelAvailable(...)
isChannelAvailable(option: BRLMChannelResult) => Promise<isChannelAvailableResult>
If you have saved the last connected <a href="#brlmchannelresult">BRLMChannelResult</a>,
you can use it to verify whether it is currently usable.
| Param | Type |
|---|---|
option |
<code><a href="#brlmchannelresult">BRLMChannelResult</a></code> |
Returns: <code>Promise<<a href="#ischannelavailableresult">isChannelAvailableResult</a>></code>
method cancelSearchWiFiPrinter()
cancelSearchWiFiPrinter() => Promise<void>
Basically, it times out, so there is no need to use it. Use it when you want to run multiple connectType searches at the same time and time out any of them manually.
method cancelSearchBluetoothPrinter()
cancelSearchBluetoothPrinter() => Promise<void>
Basically, it times out, so there is no need to use it. Use it when you want to run multiple connectType searches at the same time and time out any of them manually.
method addListener(BrotherPrintEventsEnum.onPrinterAvailable, ...)
addListener(eventName: BrotherPrintEventsEnum.onPrinterAvailable, listenerFunc: (printers: BRLMChannelResult) => void) => Promise<PluginListenerHandle>
Find the printer that can connected to the device.
| Param | Type |
|---|---|
eventName |
<code><a href="#brotherprinteventsenum">BrotherPrintEventsEnum.onPrinterAvailable</a></code> |
listenerFunc |
<code>(printers: <a href="#brlmchannelresult">BRLMChannelResult</a>) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
method addListener(BrotherPrintEventsEnum.onPrint, ...)
addListener(eventName: BrotherPrintEventsEnum.onPrint, listenerFunc: () => void) => Promise<PluginListenerHandle>
Success Print Event
| Param | Type |
|---|---|
eventName |
<code><a href="#brotherprinteventsenum">BrotherPrintEventsEnum.onPrint</a></code> |
listenerFunc |
<code>() => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
method addListener(BrotherPrintEventsEnum.onPrintFailedCommunication, ...)
addListener(eventName: BrotherPrintEventsEnum.onPrintFailedCommunication, listenerFunc: (info: ErrorInfo) => void) => Promise<PluginListenerHandle>
Failed to connect to the printer.
ex: Bluetooth is off, Printer is off, etc.
| Param | Type |
|---|---|
eventName |
<code><a href="#brotherprinteventsenum">BrotherPrintEventsEnum.onPrintFailedCommunication</a></code> |
listenerFunc |
<code>(info: <a href="#errorinfo">ErrorInfo</a>) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
method addListener(BrotherPrintEventsEnum.onPrintError, ...)
addListener(eventName: BrotherPrintEventsEnum.onPrintError, listenerFunc: (info: ErrorInfo) => void) => Promise<PluginListenerHandle>
Failed to print.
| Param | Type |
|---|---|
eventName |
<code><a href="#brotherprinteventsenum">BrotherPrintEventsEnum.onPrintError</a></code> |
listenerFunc |
<code>(info: <a href="#errorinfo">ErrorInfo</a>) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Interfaces
interface PluginListenerHandle
| Prop | Type |
|---|---|
remove |
<code>() => Promise<void></code> |
Type Aliases
type alias BRLMPrintOptions
<code>{ encodedImage: string; /** * Should use enum <a href="#brlmprintermodelname">BRLMPrinterModelName</a> */ modelName: <a href="#brlmprintermodelname">BRLMPrinterModelName</a>; } & <a href="#partial">Partial</a><<a href="#brlmchannelresult">BRLMChannelResult</a>> & (<a href="#brlmprinterqlmodelsettings">BRLMPrinterQLModelSettings</a> | <a href="#brlmprintertdmodelsettings">BRLMPrinterTDModelSettings</a>)</code>
type alias Partial
Make all properties in T optional
<code>{
[P in keyof T]?: T[P];
}</code>
type alias BRLMChannelResult
<code>{ port: <a href="#brlmprinterport">BRLMPrinterPort</a>; modelName: string; serialNumber: string; macAddress: string; nodeName: string; location: string; /** * This need to connect to the printer. * wifi: IP Address * bluetooth: macAddress * bluetoothLowEnergy: modelName for bluetoothLowEnergy */ channelInfo: string; }</code>
type alias BRLMPrinterQLModelSettings
<code>{ /** * Should use enum <a href="#brlmprinterlabelname">BRLMPrinterLabelName</a> */ labelName: <a href="#brlmprinterlabelname">BRLMPrinterLabelName</a>; } & <a href="#brlmprintersettings">BRLMPrinterSettings</a></code>
type alias BRLMPrinterSettings
These are optional. If these are not set, default values are assigned by the printer.
<code>{ /** * The number of copies you print. / numberOfCopies?: <a href="#brlmprinternumberofcopies">BRLMPrinterNumberOfCopies</a>; /* * Whether the auto-cut is enabled or not. If true, your printer cut the paper each page. / autoCut?: <a href="#brlmprinterautocuttype">BRLMPrinterAutoCutType</a>; /* * A scale mode that specifies how your data is scaled in a print area of your printer. / scaleMode?: <a href="#brlmprinterscalemode">BRLMPrinterScaleMode</a>; /* * A scale value. This is effective when ScaleMode is ScaleValue. / scaleValue?: <a href="#brlmprinterscalevaluetype">BRLMPrinterScaleValueType</a>; /* * A way to rasterize your data. / halftone?: <a href="#brlmprinterhalftone">BRLMPrinterHalftone</a>; /* * A threshold value. This is effective when the Halftone is Threshold. / halftoneThreshold?: <a href="#brlmprinterhalftonethresholdtype">BRLMPrinterHalftoneThresholdType</a>; /* * An image rotation that specifies the angle in which your data is placed in the print area. Rotation direction is clockwise. / imageRotation?: <a href="#brlmprinterimagerotation">BRLMPrinterImageRotation</a>; /* * A vertical alignment that specifies how your data is placed in the printable area. / verticalAlignment?: <a href="#brlmprinterverticalalignment">BRLMPrinterVerticalAlignment</a>; /* * A horizontal alignment that specifies how your data is placed in the printable area. / horizontalAlignment?: <a href="#brlmprinterhorizontalalignment">BRLMPrinterHorizontalAlignment</a>; /* * A compress mode that specifies how to compress your data. * note: This is ios only. / compressMode?: <a href="#brlmprintercompressmode">BRLMPrinterCompressMode</a>; /* * A priority that is print speed or print quality. Whether or not this has an effect is depend on your printer. */ printQuality?: <a href="#brlmprinterprintquality">BRLMPrinterPrintQuality</a>; }</code>
type alias BRLMPrinterNumberOfCopies
<code>number</code>
type alias BRLMPrinterAutoCutType
<code>boolean</code>
type alias BRLMPrinterScaleValueType
<code>number</code>
type alias BRLMPrinterHalftoneThresholdType
<code>number</code>
type alias BRLMPrinterTDModelSettings
<code>{ /** * Should use enum BRLMPrinterCustomPaperType / paperType: <a href="#brlmprintercustompapertype">BRLMPrinterCustomPaperType</a>; /* * The width of the label. For example, the RD-U04J1 is 60.0 wide. / tapeWidth: number; /* * The length of the label. For example, the RD-U04J1 is 60.0 wide. / tapeLength: number; /* * It is the difference between a sticker and a mount. * For example, the RD-U04J1 is 1.0, 2.0, 1.0, 2.0 / marginTop: number; marginRight: number; marginBottom: number; marginLeft: number; /* * The spacing between seals. For example, the RD-U04J1 is 0.2. / gapLength: number; paperMarkPosition: number; paperMarkLength: number; /* * Should use enum BRLMPrinterCustomPaperUnit. * For example, the RD-U04J1 is mm. */ paperUnit: <a href="#brlmprintercustompaperunit">BRLMPrinterCustomPaperUnit</a>; }</code>
type alias BRLMSearchOption
<code>{ /** * 'usb' is android only, and now developing. / port: <a href="#brlmprinterport">BRLMPrinterPort</a>; /* * searchDuration is the time to end search for devices. * default is 15 seconds. * use only port is 'wifi' or 'bluetoothLowEnergy'. */ searchDuration: number; }</code>
type alias isChannelAvailableResult
<code>{ result: boolean; }</code>
type alias ErrorInfo
<code>{ message: string; code: number; }</code>
Enums
enum BRLMPrinterModelName
| Members | Value |
|---|---|
QL_800 |
<code>'QL_800'</code> |
QL_810W |
<code>'QL_810W'</code> |
QL_820NWB |
<code>'QL_820NWB'</code> |
TD_2320D_203 |
<code>'TD_2320D_203'</code> |
TD_2030AD |
<code>'TD_2030AD'</code> |
TD_2350D_300 |
<code>'TD_2350D_300'</code> |
enum BRLMPrinterPort
| Members | Value |
|---|---|
usb |
<code>'usb'</code> |
wifi |
<code>'wifi'</code> |
bluetooth |
<code>'bluetooth'</code> |
bluetoothLowEnergy |
<code>'bluetoothLowEnergy'</code> |
enum BRLMPrinterLabelName
| Members | Value | Description |
|---|---|---|
DieCutW17H54 |
<code>'DieCutW17H54'</code> | |
DieCutW17H87 |
<code>'DieCutW17H87'</code> | |
DieCutW23H23 |
<code>'DieCutW23H23'</code> | |
DieCutW29H42 |
<code>'DieCutW29H42'</code> | |
DieCutW29H90 |
<code>'DieCutW29H90'</code> | |
DieCutW38H90 |
<code>'DieCutW38H90'</code> | |
DieCutW39H48 |
<code>'DieCutW39H48'</code> | |
DieCutW52H29 |
<code>'DieCutW52H29'</code> | |
DieCutW62H29 |
<code>'DieCutW62H29'</code> | |
DieCutW62H60 |
<code>'DieCutW62H60'</code> | |
DieCutW62H75 |
<code>'DieCutW62H75'</code> | |
DieCutW62H100 |
<code>'DieCutW62H100'</code> | |
DieCutW60H86 |
<code>'DieCutW60H86'</code> | |
DieCutW54H29 |
<code>'DieCutW54H29'</code> | |
DieCutW102H51 |
<code>'DieCutW102H51'</code> | |
DieCutW102H152 |
<code>'DieCutW102H152'</code> | |
DieCutW103H164 |
<code>'DieCutW103H164'</code> | |
RollW12 |
<code>'RollW12'</code> | |
RollW29 |
<code>'RollW29'</code> | |
RollW38 |
<code>'RollW38'</code> | |
RollW50 |
<code>'RollW50'</code> | |
RollW54 |
<code>'RollW54'</code> | |
RollW62 |
<code>'RollW62'</code> | |
RollW62RB |
<code>'RollW62RB'</code> | |
RollW102 |
<code>'RollW102'</code> | |
RollW103 |
<code>'RollW103'</code> | |
DTRollW90 |
<code>'DTRollW90'</code> | |
DTRollW102 |
<code>'DTRollW102'</code> | |
DTRollW102H51 |
<code>'DTRollW102H51'</code> | |
DTRollW102H152 |
<code>'DTRollW102H152'</code> | |
RoundW12DIA |
<code>'RoundW12DIA'</code> | |
RoundW24DIA |
<code>'RoundW24DIA'</code> | |
RoundW58DIA |
<code>'RoundW58DIA'</code> | |
RDDieCutW60H60 |
<code>'RDDieCutW60H60'</code> | For TD series |
RDDieCutW50H30 |
<code>'RDDieCutW50H30'</code> | |
RDDieCutW40H60 |
<code>'RDDieCutW40H60'</code> | |
RDDieCutW40H50 |
<code>'RDDieCutW40H50'</code> | |
RDDieCutW40H40 |
<code>'RDDieCutW40H40'</code> | |
RDDieCutW30H30 |
<code>'RDDieCutW30H30'</code> | |
RDDieCutW50H35 |
<code>'RDDieCutW50H35'</code> | |
RDDieCutW60H80 |
<code>'RDDieCutW60H80'</code> | |
RDDieCutW60H100 |
<code>'RDDieCutW60H100'</code> |
enum BRLMPrinterScaleMode
| Members | Value |
|---|---|
ActualSize |
<code>'ActualSize'</code> |
FitPageAspect |
<code>'FitPageAspect'</code> |
FitPaperAspect |
<code>'FitPaperAspect'</code> |
ScaleValue |
<code>'ScaleValue'</code> |
enum BRLMPrinterHalftone
| Members | Value |
|---|---|
Threshold |
<code>'Threshold'</code> |
ErrorDiffusion |
<code>'ErrorDiffusion'</code> |
PatternDither |
<code>'PatternDither'</code> |
enum BRLMPrinterImageRotation
| Members | Value |
|---|---|
Rotate0 |
<code>'Rotate0'</code> |
Rotate90 |
<code>'Rotate90'</code> |
Rotate180 |
<code>'Rotate180'</code> |
Rotate270 |
<code>'Rotate270'</code> |
enum BRLMPrinterVerticalAlignment
| Members | Value |
|---|---|
Top |
<code>'Top'</code> |
Center |
<code>'Center'</code> |
Bottom |
<code>'Bottom'</code> |
enum BRLMPrinterHorizontalAlignment
| Members | Value |
|---|---|
Left |
<code>'Left'</code> |
Center |
<code>'Center'</code> |
Right |
<code>'Right'</code> |
enum BRLMPrinterCompressMode
| Members | Value |
|---|---|
None |
<code>'None'</code> |
Tiff |
<code>'Tiff'</code> |
Mode9 |
<code>'Mode9'</code> |
enum BRLMPrinterPrintQuality
| Members | Value |
|---|---|
Best |
<code>'Best'</code> |
Fast |
<code>'Fast'</code> |
enum BRLMPrinterCustomPaperType
| Members | Value |
|---|---|
rollPaper |
<code>'rollPaper'</code> |
dieCutPaper |
<code>'dieCutPaper'</code> |
markRollPaper |
<code>'markRollPaper'</code> |
enum BRLMPrinterCustomPaperUnit
| Members | Value |
|---|---|
mm |
<code>'mm'</code> |
inch |
<code>'inch'</code> |
enum BrotherPrintEventsEnum
| Members | Value |
|---|---|
onPrinterAvailable |
<code>'onPrinterAvailable'</code> |
onPrint |
<code>'onPrint'</code> |
onPrintFailedCommunication |
<code>'onPrintFailedCommunication'</code> |
onPrintError |
<code>'onPrintError'</code> |