Developer Space / JavaScript Interface
Integration guide 2 of 7

JavaScript Interface Web → App

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.

What it is

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.

This is the same underlying mechanism as Deep Link Print; this page frames it specifically for web developers wiring up a "Print This" button. If you're building a native Android app instead of a website, see Intent Printer instead.

Examples

Plain text

function printReceipt() {
  const content = "Thank you for your order!\nTotal: $24.50";
  window.location.href =
    "btprinterplus://print?content=" + encodeURIComponent(content);
}

Rich text

The content string accepts a light markup syntax that Bluetooth Printer+ renders as bold text, alignment, dividers, and QR codes:

SyntaxResult
**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 lineHorizontal 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);
}

Placeholder

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>
📸 Screenshot: a website's "Print Receipt" button, next to the app opening on the same phone with the receipt already printing

Limitations