Skip to content

Add optional direct thermal printing to Niimbot printers from the lab…#1445

Open
jaimelaborda wants to merge 1 commit into
Part-DB:masterfrom
jaimelaborda:feature/niimbot-thermal-printing
Open

Add optional direct thermal printing to Niimbot printers from the lab…#1445
jaimelaborda wants to merge 1 commit into
Part-DB:masterfrom
jaimelaborda:feature/niimbot-thermal-printing

Conversation

@jaimelaborda

Copy link
Copy Markdown

…el generator

Adds a "Print to Niimbot" panel to the label generator dialog that sends the generated label straight to a Niimbot thermal printer (e.g. B1) over Web Bluetooth, without a PDF print dialog or printer driver.

The existing server-side DomPDF label is reused as-is: a new Stimulus controller rasterizes the PDF preview page-by-page with pdf.js at the printer's native resolution, converts it to a 1-bit bitmap and prints it via the niimbluelib library. No changes to the PHP label pipeline are required.

The feature is disabled by default and gated behind the NIIMBOT_ENABLED environment variable, since it is only useful for users who own such a printer.

  • Add @mmote/niimbluelib and pdfjs-dist dependencies
  • New assets/controllers/pages/niimbot_print_controller.js
  • Print options (copies, density, label type, rotation, B/W threshold) in the label dialog, gracefully disabled when Web Bluetooth is unavailable
  • NIIMBOT_ENABLED env flag (off by default), wired through parameters.yaml and a Twig global, documented in .env
  • English translations and documentation

Requires a Chromium-based browser and a secure context (HTTPS or localhost).

…el generator

Adds a "Print to Niimbot" panel to the label generator dialog that sends the
generated label straight to a Niimbot thermal printer (e.g. B1) over Web
Bluetooth, without a PDF print dialog or printer driver.

The existing server-side DomPDF label is reused as-is: a new Stimulus controller
rasterizes the PDF preview page-by-page with pdf.js at the printer's native
resolution, converts it to a 1-bit bitmap and prints it via the niimbluelib
library. No changes to the PHP label pipeline are required.

The feature is disabled by default and gated behind the NIIMBOT_ENABLED
environment variable, since it is only useful for users who own such a printer.

- Add @mmote/niimbluelib and pdfjs-dist dependencies
- New assets/controllers/pages/niimbot_print_controller.js
- Print options (copies, density, label type, rotation, B/W threshold) in the
  label dialog, gracefully disabled when Web Bluetooth is unavailable
- NIIMBOT_ENABLED env flag (off by default), wired through parameters.yaml and a
  Twig global, documented in .env
- English translations and documentation

Requires a Chromium-based browser and a secure context (HTTPS or localhost).
@jbtronics

jbtronics commented Jul 17, 2026

Copy link
Copy Markdown
Member

Thanks for the PR.

I havent looked into details yet, but some remarks:

  • Most configuration should be done via the settings system, so that it can be configured via the webUI (maybe with the ability to override that via env variables). "Env variables only" settings should only be ones that are very security crticial, which I do not see here.
  • The stimulus controller is a candidate to be lazy-loaded, so that it and its dependencies, are not loaded when this feature is disabled. how critical this is dependes on the size of it. in the end it is just a comment in the code.
  • Ideally that system should be somewhat generic. Like having an controller, which handles direct thermo printer control, and the interfacing of the niimbot is just a special case. So that other printers can be added, without much changes. Like some (abstract) base controller and reusebale template fragment for handling the form and conversion to an bitmap, the niimbot is then a specialized implementation of it. This might help with implementing ZPL/EPL printers like in ZPL/EPL Support for direct label printing. #489
  • In principle dompdf also have the ability to directly render into a bitmap, so pdf.js might be avoidable. But i guess the pdf.js solution is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants