$ show neodynamic/JSPrintManager
JSPrintManager is a client-side printing and scanning solution enabling web applications to bypass browser print dialogs by communicating with a native client application via WebSocket. The system consists of a core JavaScript library (JSPrintManager.js) that provides APIs for creating print/scan jobs, managing printer connections, and handling device-specific communication protocols (serial, USB, Bluetooth, TCP/IP, HID, IPP). A React-based demo application showcases features including printing various file formats (PDF, images, Office documents), raw printer command languages (ZPL, ESC/POS), bidirectional device communication, printer monitoring, and scanning functionality. The solution requires installation of a lightweight native client on user machines to establish the WebSocket bridge between browser and hardware devices.
The LLM identified 3 files worth highlighting for reuse:
Reusable React component for printer selection and management. Abstracts differences between local, network, USB, and Bluetooth printers while providing real-time updates via the JSPrintManager API. Demonstrates encapsulation of device discovery logic and state management in a UI component that can be dropped into any React project using JSPrintManager.
Abstract base class defining the template method for print/scan job execution. Handles asynchronous data generation (_generateDataAsync) and client transmission (sendToClient) while allowing subclasses to specify job-specific data preparation. Demonstrates a clean extensibility pattern for job processing pipelines that separates concerns of data preparation from communication logic.
Sample component illustrating bidirectional serial communication using JSPrintManager's serial port API. Shows proper connection lifecycle management (open/send/receive/close) with error handling and state updates. Represents a reusable pattern for device communication that abstracts protocol details while providing a consistent interface for serial port interactions.