Skip to content

jeffercbs/PostBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostBridge - ESC/POS Thermal Printer Bridge

PostBridge is a desktop application designed to serve as a communication bridge (middleware) between web applications (such as cloud-based Point of Sale / POS systems) and local thermal printers using the standard ESC/POS protocol. In addition to acting as a print server, PostBridge includes a powerful interactive visual designer that allows users to create, preview, and save ticket templates without writing code.


Ticket Designer Interface

PostBridge Interface


Key Features

1. Interactive Ticket Designer (Visual Designer)

  • Block-Based Editor: Design the ticket structure by adding, reordering (moving up/down), or deleting blocks.
  • Supported Components:
    • Text: Titles, descriptions, and custom notes.
    • QR Codes: Generate and embed QR codes for links, quick payments, or electronic invoicing.
    • Barcodes: Insert standard product barcodes.
    • Logos and Images: Add company branding or logos directly to the ticket header.
    • Separators and Spacers: Add dividing lines and blank spaces for formatting.
    • Columns and Dynamic Tables: Design item lists and prices with column alignments.
  • Real-Time Preview: View exactly how the ticket will print on thermal paper interactively.
  • Template Configuration: Define paper size (e.g., 80 mm or 58 mm), fonts (e.g., Consolas), and manage multiple templates (Create, Rename, Duplicate, Delete).

2. Local Print Bridge Server (HTTP Server)

  • Integrated HTTP Server: Exposes a local web service (REST API) running in the background.
  • Web Compatibility: Allows any web application to send print jobs in structured formats (such as JSON or HTML) via standard HTTP POST requests.
  • HTML-to-Ticket Renderer: Interprets HTML layouts and translates them directly into ESC/POS commands compatible with your thermal printer.

3. Connectivity and Printer Configuration

  • Multiple Connection Types (Transports):
    • Direct USB: Native low-level connection (WinUSB) for USB thermal printers.
    • Serial/COM Port: Support for virtual COM ports and traditional serial connections.
    • Network/TCP Raw: Send direct commands to network or Wi-Fi printers via TCP sockets.
  • Automatic Detection: Uses an auto-configuration and discovery service to identify and link locally connected printers.

4. Production Robustness

  • Print Queue Service: Manages concurrent requests sequentially, ensuring tickets are not mixed up or lost during high-volume sales.
  • Request Logging (Logs): Stores a local record in SQLite of all received requests, printed tickets, and error states for auditing and troubleshooting in the Requests view.

Project Architecture

The code is structured following Clean Architecture principles to maximize maintainability and decouple infrastructure details:

  • PostBridge (Presentation - WinUI 3): Intuitive graphical designer interface, connections section, and request monitoring.
  • PostBridge.Application: Use cases logic (e.g., PrintTicketUseCase, EncodeTicketUseCase, GetPrintersUseCase).
  • PostBridge.Domain: Business entities, enumerations, and contracts/interfaces of the core system (e.g., IEscPosEncoder, IPrinterService).
  • PostBridge.Infrastructure: Low-level implementations such as the logs database (SQLite), the web server (HttpBridgeServer), ESC/POS encoders, and transport drivers (UsbDriverService, NetworkRawTransport, SerialRawTransport).

Local Execution

Prerequisites

To build and run this project in your local environment, ensure you have the following installed:

  1. .NET 8.0 SDK (Download .NET).
  2. Visual Studio 2022 (version 17.8 or later recommended) with the following workloads:
    • .NET desktop development workload.
    • Universal Windows Platform development or Windows App SDK (WinUI 3).
  3. ESC/POS Thermal Printer (optional for physical testing; a serial port/printer emulator can also be used).

Setup and Running Instructions

Option A: From Visual Studio (Recommended)

  1. Open the PostBridge.slnx solution file with Visual Studio 2022.
  2. Restore NuGet packages if necessary (usually automated upon building).
  3. Select the target build platform (e.g., x64 or x86) in the top toolbar instead of Any CPU, as WinUI 3 requires a specific architecture.
  4. Choose the startup project:
    • PostBridge (Package): To run the packaged version (allows clean installation testing).
    • PostBridge: To run the unpackaged application directly.
  5. Press F5 or click the play/debug button.

Option B: From the Command Line (dotnet CLI)

To run the unpackaged application directly from the terminal:

  1. Open a command prompt (PowerShell or CMD) in the project root.
  2. Run the command:
    dotnet run --project PostBridge/PostBridge/PostBridge.csproj -c Debug -f net8.0-windows10.0.19041.0

About

PostBridge is a WinUI 3 desktop application for .NET 8 that acts as a local HTTP print bridge for ESC/POS printers, featuring an interactive visual ticket designer and raw connectivity over USB, serial, and network protocols.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors