@cabletv102/evolve-badge-print
v1.0.1
Published
Used to print badges to Brother printers QL series.
Downloads
22
Readme
evolve-badge-print
Used to print badges to Brother printers QL series.
Install
npm install @cabletv102/evolve-badge-print
npx cap syncAPI
searchBluetoothPrinters()ensureBluetoothEnabled()searchWifiPrinters(...)searchUSBPrinters(...)searchBLEPrinters(...)transferTemplate(...)removeTemplateWithKey(...)getPrinterInfo(...)printImage(...)printPDF(...)printImageFromURL(...)printTemplateWithKey(...)getTemplateInfo(...)- Interfaces
- Type Aliases
searchBluetoothPrinters()
searchBluetoothPrinters() => Promise<{ printers: PrinterInfo[]; }>Searches for Bluetooth printers using the Brother Mobile SDK for both android and ios.
Returns: Promise<{ printers: PrinterInfo[]; }>
ensureBluetoothEnabled()
ensureBluetoothEnabled() => Promise<{ enabled: boolean; }>(Android only) Checks if Bluetooth is enabled, and if not, prompts the user to enable it in system settings.
Returns: Promise<{ enabled: boolean; }>
searchWifiPrinters(...)
searchWifiPrinters(options?: { timeout?: number | undefined; } | undefined) => Promise<{ printers: PrinterInfo[]; }>Searches for Wifi printers using the Brother Mobile SDK for both android and ios.
| Param | Type | Description |
| ------------- | ---------------------------------- | ---------------------------------------------------------------------- |
| options | { timeout?: number; } | Optional parameters, e.g., timeout in seconds for the search duration. |
Returns: Promise<{ printers: PrinterInfo[]; }>
searchUSBPrinters(...)
searchUSBPrinters(options?: { timeout?: number | undefined; } | undefined) => Promise<{ printers: PrinterInfo[]; }>Searches for USB printers using the Brother Mobile SDK FOR ANDROID ONLY.
| Param | Type | Description |
| ------------- | ---------------------------------- | ---------------------------------------------------------------------- |
| options | { timeout?: number; } | Optional parameters, e.g., timeout in seconds for the search duration. |
Returns: Promise<{ printers: PrinterInfo[]; }>
searchBLEPrinters(...)
searchBLEPrinters(options?: { timeout?: number | undefined; } | undefined) => Promise<{ printers: PrinterInfo[]; }>Searches for BLE printers using the Brother Mobile SDK for both android and ios.
| Param | Type | Description |
| ------------- | ---------------------------------- | ---------------------------------------------------------------------- |
| options | { timeout?: number; } | Optional parameters, e.g., timeout in seconds for the search duration. |
Returns: Promise<{ printers: PrinterInfo[]; }>
transferTemplate(...)
transferTemplate(options: { templateName: string; templateData: string; printer: PrinterInfo; }) => Promise<{ success: boolean; }>Transfers a template file to the printer.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| options | { templateName: string; templateData: string; printer: PrinterInfo; } | Object containing printer info and the template file data or path. |
Returns: Promise<{ success: boolean; }>
removeTemplateWithKey(...)
removeTemplateWithKey(options: { templateKey: Number; printer: PrinterInfo; }) => Promise<{ success: boolean; }>Removes a template file currently available in the printer.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------- |
| options | { templateKey: Number; printer: PrinterInfo; } | Object containing printer info and the template key. |
Returns: Promise<{ success: boolean; }>
getPrinterInfo(...)
getPrinterInfo(options: { printer: PrinterInfo; }) => Promise<{ details: Record<string, any>; }>Gets detailed information about a connected printer.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------------- | ------------------------------------- |
| options | { printer: PrinterInfo; } | Object containing the target printer. |
Returns: Promise<{ details: Record<string, any>; }>
printImage(...)
printImage(options: { imageBase64: string; printer: PrinterInfo; }) => Promise<{ success: boolean; }>Prints a base64-encoded image to a printer.
| Param | Type | Description |
| ------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| options | { imageBase64: string; printer: PrinterInfo; } | Object containing the base64 image data and printer info. |
Returns: Promise<{ success: boolean; }>
printPDF(...)
printPDF(options: { pdfBase64: string; printer: PrinterInfo; }) => Promise<{ success: boolean; }>Prints a PDF document to a printer.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------- |
| options | { pdfBase64: string; printer: PrinterInfo; } | Object containing the base64 PDF data and printer info. |
Returns: Promise<{ success: boolean; }>
printImageFromURL(...)
printImageFromURL(options: { url: string; printer: PrinterInfo; }) => Promise<{ success: boolean; }>Prints an image from a URL (or data URI) to a printer.
| Param | Type | Description |
| ------------- | ------------------------------------------------------------------------------ | -------------------------------------------------- |
| options | { url: string; printer: PrinterInfo; } | Object containing the URL string and printer info. |
Returns: Promise<{ success: boolean; }>
printTemplateWithKey(...)
printTemplateWithKey(options: { templateKey: string; replacers?: { [key: string]: any; } | undefined; printer: PrinterInfo; }) => Promise<{ success: boolean; }>Prints a template to a printer using a specified template key and replacers.
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| options | { templateKey: string; replacers?: { [key: string]: any; }; printer: PrinterInfo; } | Object containing the template key, optional replacers, and printer info. |
Returns: Promise<{ success: boolean; }>
getTemplateInfo(...)
getTemplateInfo(options: { printer: PrinterInfo; }) => Promise<{ templateInfo: any[]; }>Gets the template info from a printer.
| Param | Type | Description |
| ------------- | ----------------------------------------------------------------- | ----------------------------------- |
| options | { printer: PrinterInfo; } | Object containing the printer info. |
Returns: Promise<{ templateInfo: any[]; }>
Interfaces
PrinterInfo
| Prop | Type | Description |
| ---------------- | ------------------- | --------------------------------------------- |
| name | string | The name of the printer. |
| model | string | The printer model, if available. |
| macAddress | string | The MAC address of the printer, if available. |
| ipAddress | string | The IP address of the printer, if applicable. |
Number
An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.
| Method | Signature | Description | | ----------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | toString | (radix?: number | undefined) => string | Returns a string representation of an object. | | toFixed | (fractionDigits?: number | undefined) => string | Returns a string representing a number in fixed-point notation. | | toExponential | (fractionDigits?: number | undefined) => string | Returns a string containing a number represented in exponential notation. | | toPrecision | (precision?: number | undefined) => string | Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. | | valueOf | () => number | Returns the primitive value of the specified object. |
Type Aliases
Record
Construct a type with a set of properties K of type T
{ [P in K]: T; }
