API: Print to Brother QL Series Thermal Printer
Send print requests to a Brother QL-Series printer. Print HTML strings or documents at a different URL.
In this article
Requirements
- Integration of our JavaScript API into your webpage
- Sample code to run within the app and download for integration into your own project is available here.
- Best practices for working with the JavaScript API are available here.
- App Settings
- Content > JavaScript API > Access JavaScript API = By Import
- Printing > Brother QL Series Label Printer > Enable Brother Printer = On
- Printing > Brother QL Series Label Printer > Select Printer = printer connected
- iOS/iPadOS Permissions
- Bluetooth - more on enabling specific iOS/iPadOS permissions here.
- Physical Hardware
- Brother QL-Series thermal printer - more information available here.
Triggers via API Functions
Print HTML String
This function prints a specific HTML string that you define. For example, you can define this as <p style="font-size: 30px">Print me</p>
.
Format | kp_BrotherPrinter_printHTMLString(htmlString, cut, preview); |
Parameters |
|
Triggers | If the print is successful, the app will immediately call kp_BrotherPrinter_printDidFinish. If an error occurs, the app will immediately call kp_BrotherPrinter_printDidFailWithError, passing more detail about the error as a parameter. |
Print Page via URL
This function prints a specific HTML page from a URL. Note: this cannot print files stored locally on the device.
Format | kp_BrotherPrinter_printDocumentAtURL(url, cut, preview); |
Parameters |
|
Triggers | If the print is successful, the app will immediately call kp_BrotherPrinter_printDidFinish. If an error occurs, the app will immediately call kp_BrotherPrinter_printDidFailWithError, passing more detail about the error as a parameter. |
Notifications via API Callbacks
When Printing is Successful
This callback is run when a print call is successful.
Format | kp_BrotherPrinter_printDidFinish(); |
When Printing Fails
This callback is run when a print call is successful.
Format | kp_BrotherPrinter_printDidFailWithError(error); |
Return values |
|
Sample Code
- This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
- To run sample code, set the app's homepage to https://www.kioskgroup.com/brother-api
- To download a .zip of sample code, click here.
Change Log
- Added in version 10.1.