print-util is a silent PDF print server designed for local printing without any dialog boxes or pop-ups. It serves as a robust solution for automating PDF printing processes on Windows 10/11 (64-bit).
Key Features:
Multiple PDF Engines Support: Utilizes preferred engines like SumatraPDF, Ghostscript, or Adobe Acrobat to ensure reliable and efficient printing.
API Integration: Offers an HTTP API for seamless integration with other applications, allowing POST requests to trigger print jobs without user interaction.
Silent Printing: Operates without displaying any user interface, making it ideal for automated workflows.
Local Service: Runs as a local server on 127.0.0.1, ensuring security and preventing external access.
Winget Installation: Can be installed via winget, simplifying deployment across Windows environments.
Audience & Benefit:
Ideal for developers, IT professionals, and organizations requiring automated PDF printing solutions. It enables seamless integration into existing workflows, reducing manual intervention and enhancing efficiency in print tasks.
README
print-util
Local HTTP server nhận file PDF qua API và in ngầm (silent) — không mở hộp thoại chọn máy in hay kích thước trang.
Yêu cầu
Windows 10/11 (64-bit)
Một trong các PDF engine sau (theo thứ tự ưu tiên):
# Port mặc định: 17474
.\print-util.exe
# Chỉ định port
.\print-util.exe 8080
# Hoặc qua biến môi trường
$env:PORT = 17474; .\print-util.exe
Server chỉ lắng nghe trên 127.0.0.1 (localhost), không expose ra ngoài.
API
GET /health
Kiểm tra server đang chạy.
200 OK
{ "status": "ok" }
POST /print
In một file PDF.
Request:multipart/form-data
Field
Bắt buộc
Mô tả
file
✓
Nội dung file PDF
printer
—
Tên máy in. Bỏ trống = dùng máy in mặc định
Response thành công:
{ "status": "ok" }
Response lỗi:
{ "error": "mô tả lỗi" }
HTTP status codes:
Code
Ý nghĩa
200
In thành công
400
Thiếu field hoặc dữ liệu không hợp lệ
500
Lỗi khi gửi lệnh in
Ví dụ
curl
# In bằng máy in mặc định
curl -X POST http://127.0.0.1:17474/print -F "file=@document.pdf"
# Chỉ định máy in
curl -X POST http://127.0.0.1:17474/print \
-F "file=@document.pdf" \
-F "printer=HP LaserJet Pro"