Windows REST API Print Server - Print PDFs from anywhere
Turn any Windows PC with a printer into a network print server with a simple REST API. Perfect for automating document printing from web apps, scripts, or remote systems.
- Web Applications - Print invoices, labels, receipts from your web app
- Workflow Automation - Integrate printing into scripts and CI/CD
- Remote Printing - Print from mobile apps or remote systems
- Label Printing - Automate shipping label printing
- Document Processing - Batch print generated documents
- Download the latest AutomaPrint.exe
- Run the executable
- Select your printer from the list
- Done! Your print server is running at
http://localhost:8080
Test it:
curl http://localhost:8080/healthPrint a PDF:
curl -X POST -H "Content-Type: application/pdf" \
--data-binary @document.pdf \
http://localhost:8080/printAutomaPrint features a full GUI application with system tray support.
The application opens with a tabbed interface:
- Server Tab - Start/stop server, configure printer and port, view server logs
- Test Client Tab - Test printing with sample PDFs
- Settings Tab - Configure print settings (scaling, color, duplex), enable auto-start, and update SumatraPDF/Cloudflare
- About Tab - Version info and API documentation
When minimized, AutomaPrint runs in your system tray:
- Double-click - Show/hide main window
- Right-click menu - Show Window, Hide Window, Start Server, Stop Server, Quit
Access settings via the Settings tab in the main window, or the Server tab for printer/port selection
| Setting | Options | Description |
|---|---|---|
| Scaling | Fit / Shrink / Original | How pages fit on paper |
| Color | Color / Monochrome | Color or black & white |
| Duplex | Single / Long Edge / Short Edge | Single or double-sided |
Enable remote printing from anywhere:
- Open the Server tab
- Check Enable Cloudflare Tunnel
- Click Start Server
- Copy the tunnel URL (e.g.,
https://xyz.trycloudflare.com) - Copy the API key for authentication
Print remotely:
curl -X POST \
-H "Content-Type: application/pdf" \
-H "X-API-Key: your-api-key" \
--data-binary @document.pdf \
https://xyz.trycloudflare.com/printSettings are stored in %USERPROFILE%\AutomaPrint\config.json
{
"printer_name": "HP LaserJet Pro",
"port": 8080,
"auto_start": true,
"minimize_to_tray": true,
"print_scaling": "shrink",
"print_color": "color",
"print_duplex": "simplex",
"use_tunnel": false,
"api_key": "auto-generated-uuid"
}Enable in the Settings tab β Auto-start with Windows
AutomaPrint will:
- Start minimized to system tray
- Automatically launch the print server
- Use your saved configuration
- Ensure printer is installed and online
- Check printer name matches exactly (case-sensitive)
- Restart AutomaPrint
- Change port in Settings (default: 8080)
- Check if another application is using the port
- Verify PDF file is valid
- Check SumatraPDF downloaded (in
%USERPROFILE%\AutomaPrint\) - Test with the included
blank.pdf
Add firewall exception:
- Windows Security β Firewall
- Allow an app through firewall
- Add
AutomaPrint.exe
GET /healthResponse:
{
"status": "ok",
"printer": "HP LaserJet Pro",
"version": "1.0.0"
}POST /print
Content-Type: application/pdf
[PDF binary data]Optional Query Parameters:
printer- Override default printer
Headers (when tunnel enabled):
X-API-Key- Authentication key
Response:
{
"status": "success",
"message": "Print job sent successfully"
}Error Response:
{
"status": "error",
"error": "Printer not found"
}graph TB
A[Client Application] -->|HTTP POST| B[AutomaPrint Server]
B -->|Download if missing| C[SumatraPDF]
B -->|Print Command| C
C -->|Win32 API| D[Windows Print Spooler]
D --> E[Physical Printer]
F[Cloudflare Tunnel] -.->|Optional| B
F -->|HTTPS + API Key| G[Remote Client]
style B fill:#4CAF50
style C fill:#2196F3
style F fill:#FF9800
import requests
with open('document.pdf', 'rb') as f:
response = requests.post(
'http://localhost:8080/print',
data=f,
headers={'Content-Type': 'application/pdf'}
)
print(response.json())const fs = require('fs');
const axios = require('axios');
const pdf = fs.readFileSync('document.pdf');
axios.post('http://localhost:8080/print', pdf, {
headers: {'Content-Type': 'application/pdf'}
}).then(res => console.log(res.data));$pdf = file_get_contents('document.pdf');
$ch = curl_init('http://localhost:8080/print');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $pdf);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/pdf']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
echo $response;Requirements:
- Python 3.11+
- Windows OS
Setup:
git clone https://github.com/ksi-digital/automaprint.git
cd automaprint
# Install dependencies
pip install -r requirements.txt
# Run in development
python main.py
# Build executable
python build.pyOutput: dist/AutomaPrint.exe
# Run GUI (default)
python main.py
# Run server only (no GUI)
python main.py server
# Show help
python main.py --helpAuto-Downloaded (Runtime):
- SumatraPDF - PDF rendering engine
- cloudflared - Cloudflare tunnel client (optional)
Python Packages:
- Flask - REST API framework
- pywin32 - Windows API
- pystray - System tray
- Pillow - Image processing
See requirements.txt for versions.
Create a new release by tagging:
git tag v1.0.0
git push origin v1.0.0GitHub Actions will automatically:
- Build Windows executable
- Create GitHub release
- Attach
.exeand.zipfiles
MIT License - see LICENSE file.
Free to use, modify, and distribute.
Contributions welcome! Please:
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add feature') - Push to branch (
git push origin feature/amazing) - Open Pull Request
- Issues: GitHub Issues
- Discussions: GitHub Discussions
KSI Digital
- Website: ksi-digital.com
- GitHub: @ksi-digital
- SumatraPDF - Lightweight PDF viewer
- Cloudflare - Tunnel infrastructure
