Skip to content

lkphuong/go-printer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Printer

A cross-platform printing service built with Go and Gin framework. This application provides REST API endpoints for managing printers, print configurations, and print jobs.

Features

  • List available printers
  • Get and set print configurations
  • Submit print jobs
  • Clear print cache
  • Cross-platform support (macOS, Linux, Windows)
  • RESTful API with CORS support

Installation

Prerequisites

  • Go 1.23 or later
  • CUPS (on macOS/Linux) or Windows printing services

Clone the repository

git clone https://github.com/lkphuong/go-printer.git
cd go-printer

Install dependencies

go mod download

Usage

Running the server

make run

Or directly:

go run ./cmd/server/main.go

The server will start on port 9099.

Building for different platforms

# Build for Windows
make build-windows

# Build for macOS (ARM64)
make build-mac

Downloads

Download the pre-built binaries from the build folder:

API Endpoints

All endpoints are prefixed with /api/v1.

Printers

  • GET /printers - Get list of available printers
  • POST /printers/jobs - Submit a print job

Example API Usage

# Get printers
curl http://localhost:9099/api/v1/printers

# Submit a print job (example payload)
curl -X POST http://localhost:9099/api/v1/printers/jobs \
  -H "Content-Type: application/json" \
  -d '{"printer": "MyPrinter", "file": "path/to/file.pdf"}'

Project Structure

go-printer/
├── cmd/server/          # Main application entry point
├── internal/
│   ├── app/            # Application setup and initialization
│   ├── handlers/       # HTTP request handlers
│   ├── services/       # Business logic services
│   ├── routers/        # Route definitions
│   ├── dto/            # Data transfer objects
│   └── utils/          # Utility functions
├── config/             # Configuration files
├── uploads/            # Uploaded files directory
├── docs/               # Documentation
├── build/              # Build artifacts
└── README.md

Dependencies

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A cross-platform printing service built with Go and Gin framework. This application provides REST API endpoints for managing printers, print configurations, and print jobs.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors