MPOS Printer Implementation using Java Point of Sales
- Print receipts with text, barcodes, and images
- Generate receipts as PDFs
- Real-time print job handling via WebSocket server
- Configurable printer, paper, and font settings via
printer.properties - Logging with SLF4J and Logback
- Java 8 or higher (Java 8+ recommended)
- Maven (or use the included Maven Wrapper)
Using Maven Wrapper (recommended):
./mvnw clean packageOr with Maven:
mvn clean packageThis will generate the executable JAR with dependencies at:
target/printer-1.0-SNAPSHOT-jar-with-dependencies.jar
./mvnw exec:javajava -jar target/printer-1.0-SNAPSHOT-jar-with-dependencies.jarEdit printer.properties to set printer name, port, paper size, font, and other options.
- WebSocket Server: Listens on the port defined in
printer.properties(default: 20001) - Receipt Printing: Supports text, barcode, and image lines
- PDF Generation: Uses PDFBox for PDF output
- Barcode Support: Uses ZXing for barcode generation
- Configurable Paper & Font: Paper size, margins, and font are all configurable
- Logging: All major actions are logged for traceability
- POS Integration: Connect your POS system to the WebSocket server and send print jobs as JSON
- Custom Receipts: Define receipt content (text, barcode, images) and send to the printer
- PDF Output: Generate and print receipts as PDFs for archiving or emailing
- Start the application (see above)
- POS system connects to WebSocket server on the configured port
- POS sends a JSON message describing the receipt (lines, barcodes, etc.)
- Application processes the message and prints the receipt
- Logs and output are available for troubleshooting
For more details, see the printer.properties file and the source code in src/main/java/id/modefashion/printer.