Skip to content

Premod1/silent-printer-bridge

Repository files navigation

📟 Silent Print Bridge v2.7.0

This is a local Node.js bridge that allows web applications to print HTML content directly to thermal printers (58mm/80mm) without showing a print dialog. It uses Puppeteer to generate high-quality PDFs and pdf-to-printer to communicate with the hardware.

💾 Download Installer

You can download the compiled Windows background service installer directly:

📦 Client Integration

If you are developing a Node.js/web application, you can use the pre-built integration package to connect to this bridge easily:

🚀 How it Works

  1. Request: Your POS application (Frontend) sends a POST request with HTML content to the bridge.
  2. Rendering: The bridge opens a hidden Chrome browser (via Puppeteer) and renders the HTML.
  3. Generation: It generates a pixel-perfect PDF tailored to the specific width (e.g., 58mm).
  4. Printing: The PDF is sent directly to the specified local printer driver.
  5. Cleanup: Temporary files and browser tabs are automatically cleared to save RAM.

🔌 Connection Details

  • Port: 8080 (HTTPS)
  • Base URL: https://localhost:8080
  • Content-Type: application/json

Tip

Avoid Security Warnings: To bypass the "Not Secure" warning in Chrome/Edge permanently, enable this flag: chrome://flags/#allow-insecure-localhost


🛠 API Endpoints

1. Get Available Printers

Use this to fetch the exact names of the printers installed on the system.

  • Endpoint: GET /printers
  • Response:
{
  "success": true,
  "printers": [
    "XP-58",
    "Kitchen_Printer"
  ]
}

2. Print HTML Receipt

Submits an HTML string to render silently in the background and prints to the specified printer device name. Supports customized 58mm and 80mm layouts.

  • Endpoint: POST /print (also accepts POST /print-html)
  • Payload Parameters:
    • html (Required): HTML string content to be printed.
    • printerName (Required): Exact printer device name.
    • width (Optional): "58mm" | "80mm" (Default: "80mm").
    • waitUntil (Optional): Puppeteer wait condition (e.g. "load", "networkidle0", Default: "networkidle0").
  • Request Example:
{
  "html": "<h1>Receipt Title</h1><p>Item 1: $10.00</p>",
  "printerName": "XP-58",
  "width": "58mm"
}
  • Response:
{
  "success": true,
  "message": "Sent to XP-58 spooler"
}

About

This is a local Node.js bridge that allows web applications to print HTML content directly to thermal printers (58mm/80mm) without showing a print dialog. It uses Puppeteer to generate high-quality PDFs and `pdf-to-printer` to communicate with the hardware.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors