pagedrop-print-agent
v0.1.1
Published
Polls PageDrop for paid orders and auto-prints them on the shop's local printer.
Readme
PageDrop Print Agent
Runs on the print shop's own computer. Polls PageDrop every few seconds for paid orders, downloads the files, and sends them to the shop's printer automatically — no manual checking of an admin dashboard required.
Setup
The easiest way — no local checkout needed. On the shop's computer, with Node.js 18+ installed:
npx pagedrop-print-agent setupThis walks through registering/pairing with a shop (get a pairing code from
/signup first), auto-detects local printers, writes a .env config, and
runs a safe dry-run test print. Then start it:
npx pagedrop-print-agentIt starts in dry-run mode by default — it will fetch real jobs and log
exactly what it would print, without sending anything to the printer. Watch
the log output, confirm the jobs look right, then set PAGEDROP_DRY_RUN=false
in .env and restart to start printing for real.
Running from this repo instead
If you're developing against this repo directly rather than the published
package: copy .env.example to .env, fill in PAGEDROP_API_BASE_URL,
PAGEDROP_PRINT_AGENT_API_KEY, and PAGEDROP_PRINTER_NAME, then
npm install && node index.js (or node index.js setup for the wizard).
How it works
- Polls
GET /api/print-agent/jobseveryPAGEDROP_POLL_INTERVAL_MS(default 15s), authenticated with the shop's API key. - For each order: prints an auto-generated front sheet (order ID +
collection code + file count, always B&W/A4), then downloads and prints
every file honoring the customer's color/B&W choice, then a back sheet
marking the end of that order — so a stack of printed paper is easy to sort
by order without checking a screen. See
coversheet.js. - Reports back
printedorprint_failedso the order won't be picked up again once done. - Failed jobs are retried automatically on the next poll.
Platform support
- macOS / Linux: uses the system's
lp(CUPS) command — full support for color mode and paper size. - Windows: best-effort only. Uses the OS's default "Print" handler via
PowerShell, which can't control color mode or paper size from the CLI.
For real control on Windows, replace the Windows branch in
index.jswith SumatraPDF's-print-toflag.
Running it continuously
This is a long-running process — the shop needs it running whenever they want auto-print to work. Options:
- macOS: wrap it in a
launchdagent (~/Library/LaunchAgents) - Windows: run it as a scheduled task at login, or wrap with pm2 / node-windows
- Linux: a
systemdservice
Keeping this yours to resell
Each print shop gets its own PAGEDROP_PRINT_AGENT_API_KEY, scoped to that
shop's orders only — one shop's agent can never see or print another shop's
files.
