API: Print to Bixolon Printer
Send print requests to a Bixolon printer. Print elements on the page, HTML strings or documents at a different URL.
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
- iOS/iPadOS Permissions
- Bluetooth - more on enabling specific iOS/iPadOS permissions here.
- Physical Hardware
- Bixolon thermal printer - more information available here.
Triggers via API Functions
Print HTML Element on Page
This function prints an element on the page based on the id attribute. For example, if your page has <p id="print">Print me</p>
you can print only this <p>
tag by setting the "elementId" parameter to the id "print".
Format | kp_BixolonPrinter_printHTMLElement(elementId, cut); |
Parameters |
|
Triggers | If the print is successful, the app will immediately call kp_BixolonPrinter_printDidFinish. If an error occurs, the app will immediately call kp_BixolonPrinter_printDidFailWithError, passing more detail about the error as a parameter. |
Print HTML String
This function prints a specific HTML string that you define. This is useful if you do not want to include the printed element on the page. For example, you can define this as <p style="font-size: 30px">Print me</p>
.
Format | kp_BixolonPrinter_printHTMLString(htmlString, cut); |
Parameters |
|
Triggers | If the print is successful, the app will immediately call kp_BixolonPrinter_printDidFinish. If an error occurs, the app will immediately call kp_BixolonPrinter_printDidFailWithError, passing more detail about the error as a parameter. |
Print Page via URL
This function prints a specific page or document from a URL. This is useful if you want to print a PDF, for example. Note: this cannot print files stored locally on the device.
Format | kp_BixolonPrinter_printHTMLString(url, cut); |
Parameters |
|
Triggers | If the print is successful, the app will immediately call kp_BixolonPrinter_printDidFinish. If an error occurs, the app will immediately call kp_BixolonPrinter_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_BixolonPrinter_printDidFinish(); |
When Printing Fails
This callback is run when a print call is successful.
Format | kp_BixolonPrinter_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/bixolon-api
- To download a .zip of sample code, click here.
Change Log
- Added in version 8.5.