The easiest way to add printing to your website: add a "Print" button that opens Bluetooth Printer+ on the visitor's own phone and prints immediately - pure client-side JavaScript, no backend or API key required.
Bluetooth Printer+ registers the custom URI scheme btprinterplus://. Any JavaScript running in a mobile browser on the same phone can open that URI - via window.location.href or a plain <a href="btprinterplus://..."> link - and Android hands control straight to the app, which connects to the phone's default printer and prints.
function printReceipt() {
const content = "Thank you for your order!\nTotal: $24.50";
window.location.href =
"btprinterplus://print?content=" + encodeURIComponent(content);
}
The content string accepts a light markup syntax that Bluetooth Printer+ renders as bold text, alignment, dividers, and QR codes:
| Syntax | Result |
|---|---|
**text** | Bold |
[center]text[/center] | Centered line(s) |
[right]text[/right] | Right-aligned line(s) |
[small]text[/small] | Condensed font |
[qr]data[/qr] | QR code encoding "data" |
| 8+ dashes on a line | Horizontal divider |
function printFormattedReceipt() {
const content =
"[center]**MY STORE**[/center]\n" +
"--------------------------------\n" +
"2x Coffee $7.00\n" +
"1x Muffin $3.50\n" +
"--------------------------------\n" +
"**Total: $10.50**\n" +
"[qr]https://mystore.example/order/1042[/qr]";
window.location.href =
"btprinterplus://print?content=" + encodeURIComponent(content);
}
Add placeholder_<name>=<value> query params to fill in [[name]] tokens inside content at print time - handy for reusing one saved template with different values per visitor:
function printWithPlaceholders(customerName, orderId) {
const content = "Hello [[name]],\nYour order #[[order]] is ready.";
const url = "btprinterplus://print?content=" + encodeURIComponent(content)
+ "&placeholder_name=" + encodeURIComponent(customerName)
+ "&placeholder_order=" + encodeURIComponent(orderId);
window.location.href = url;
}
printWithPlaceholders("Arun", "A-1042");
A plain <a> tag works too, and is often more reliable than window.location.href on iOS/Safari-based webviews:
<a href="btprinterplus://print?content=Hello%20World">Print Test</a>