Back to home
Developer guide
Local REST API · http://127.0.0.1:1337

Ship silent printing in minutes

PrintBridge runs on Windows and exposes a small HTTP API on your machine. Your web app calls it like any other backend—no browser print dialog, no PDF popups—just predictable, scriptable prints.

Before you integrate

These details save debugging time when something does not print on the first try.

Local only
The bridge listens on 127.0.0.1. Your page must be able to reach that address from the machine where PrintBridge is installed—typically a POS or office PC running your app in the browser.
HTTPS pages
Browsers may block mixed content (an HTTPS site calling http://127.0.0.1). If that applies to you, proxy print calls through your own backend (see the Next.js example below) or run the UI onhttp://localhostduring development.

Quick start

Confirm the service is up, then send your first print job from JavaScript.

1 · Health check

health-check.js
// Check that PrintBridge is running (from your frontend or a devtools console)
const res = await fetch("http://127.0.0.1:1337/health");
const body = await res.json();
console.log(body);

2 · Print from the browser

print.js
async function printLabel() {
  const response = await fetch("http://127.0.0.1:1337/v1/print", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      printer: "Zebra ZD420",
      format: "zpl",
      data:
        "^XA^FO50,50^ADN,36,20^FDHello from the web^FS^XZ",
    }),
  });

  if (!response.ok) {
    const err = await response.text();
    throw new Error(err || "Print failed");
  }

  return response.json();
}

Production-friendly patterns

Keep your integration small, typed, and easy to test.

Shared client module

printbridge.ts
/**
 * printbridge.ts — tiny client for your app bundle
 * Adjust paths to match your PrintBridge version / docs.
 */
const BASE = "http://127.0.0.1:1337";

export type PrintRequest = {
  printer: string;
  format: "zpl" | "raw" | "pdf";
  data: string;
};

export async function sendPrint(req: PrintRequest) {
  const res = await fetch(`${BASE}/v1/print`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(req),
  });
  if (!res.ok) {
    const text = await res.text();
    throw new Error(text || `HTTP ${res.status}`);
  }
  return res.json() as Promise<{ ok: boolean; jobId?: string }>;
}

Next.js App Router proxy (optional)

When the browser cannot reach localhost directly, forward jobs from a trusted server route your app already talks to.

app/api/print/route.ts
// app/api/print/route.ts — proxy from your Next.js server if you
// cannot call 127.0.0.1 from the browser (e.g. hosted HTTPS app).

import { NextResponse } from "next/server";

const BRIDGE = "http://127.0.0.1:1337";

export async function POST(request: Request) {
  const body = await request.json();
  const res = await fetch(`${BRIDGE}/v1/print`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(body),
  });
  const text = await res.text();
  return new NextResponse(text, {
    status: res.status,
    headers: { "Content-Type": res.headers.get("Content-Type") ?? "application/json" },
  });
}

Request shape

The snippets above use a representative JSON body. Match field names and routes to your installed PrintBridge version and product documentation.

{
  "printer": "Name as shown in Windows",
  "format": "zpl" | "raw" | "pdf",
  "data": "Payload for that format"
}

Prefer named printers your operators recognize, validate payloads before calling the bridge, and surface HTTP errors in your UI so support can triage quickly.

Ready to cut the print dialog out of your workflow?

Create an account, install PrintBridge on your Windows machines, and wire your first silent print using the examples above.