Print agent

The print agent

A small service that runs next to your printers, dials out to your API server and writes each job to the printer beside it. This page is about the agent itself: where it runs, how it pairs and connects, what it does with a job, and what happens when it is offline or revoked.

What is built today: Status

Your infrastructureYou run the agent. BarcoderX hosts nothing for you: the agent, your API server and your printers all sit on infrastructure you operate, and no label data is sent to BarcoderX.

The agent at a glance

What it is
A print agent: a service that runs beside the printers and prints what your API server sends it.
When you need one
When you print from a server or cloud that you run to printers on another network. Printing straight from your own .NET process needs no agent.
Runs as
A Windows service, or a systemd daemon on Linux. It installs from one signed file.
Runs on
Windows x64, Linux x64 and Linux arm64. On Windows: Windows 10, Windows 11 and Windows Server 2019 or later.
Connects
Outbound only: HTTPS and one WebSocket to your API server. It listens on no port.
Prints to
The printers it can see: the local print queues and ports on its machine or network.

One job, from pairing to the printer

The agent starts every connection. Nothing connects in to it, so the printer network needs no inbound port. The diagram follows the agent from the day it is paired to a job reaching a printer.

Schematic of the print agent pairing, connecting and printing a job Three parties: your API server, the print agent and the printer. The agent and the printer sit on your printer network, where nothing connects in. Step 1: the agent sends a one-time pairing code and the public half of its key to the API server. Step 2: the agent opens an HTTPS connection and one WebSocket to the API server. Step 3: the API server sends a signed job down that same connection. Step 4: the agent checks the signature and skips a job id it has already handled. Step 5: the agent writes the raw bytes to the printer. PRINTER NETWORK nothing connects in API server you run it Print agent beside the printers Printer on the network 1 Pairing code and public key, once 2 Opens HTTPS and one WebSocket 3 Signed job, down the same connection 4 Checks signature skips known job ids 5 Raw bytes
Schematic. The arrows show who starts each connection. In step 3 the job travels down the connection the agent opened in step 2, so nothing connects in to the agent.
  1. PairAn administrator creates a one-time code. The agent enrolls with it and sends only the public half of a key pair it made on the machine.
  2. ConnectThe agent opens HTTPS and one WebSocket to your API server, and holds them open.
  3. ReceiveJobs arrive down that connection, signed by the server.
  4. VerifyThe agent checks the signature and skips a job id it has already handled.
  5. WriteIt writes the bytes to the printer beside it.

Where it runs

Put an agent on a machine at each site that can reach that site's printers: beside them, on their network. It makes outbound connections only, so the machine needs outbound HTTPS to your API server and no inbound port. Which route it uses to a printer depends on the operating system it runs on.

The agent on Windows and on Linux: how it runs, how it reaches printers and how it prints on color and non-thermal printers
PlatformRuns asReaches printers byColor and non-thermal printers
Windows A Windows service, on Windows 10, Windows 11 or Windows Server 2019 or later. TCP port 9100, or the Windows spooler (RAW). Raster pages, drawn through GDI from the same layout.
Linux A systemd daemon, on x64 or arm64. TCP port 9100, CUPS, or USB as a raw device. PDF, drawn through CUPS from the same layout.

The agent is one half of the queued route; the other half is the API server that holds the queue, which you also run. How that route compares with printing directly, through a printer maker's cloud or through the spooler is on Server-side label printing for .NET, and this page does not repeat it.

Labels printed at a desk, such as event wristbands and badges, or at a draw station, such as specimen labels, can use this route.

Pairing, not passwords

Create a pairing code

An administrator creates a one-time pairing code. It expires after ten minutes.

The agent enrolls

You run the agent where the printer is, and enter the code. The agent enrolls with your API server, creates its own key pair on the machine and sends only the public half. The private key stays on the machine.

Register the printers

The agent lists the local print queues and ports it can see. You choose the ones to register, each with its printer language and its profile.

After pairing, the agent authenticates with signed assertions, and its access tokens are short-lived and bound to the agent and to the tenant.

Agent security API: printers and agents

The connection

Direction
Outbound only. The agent opens the connection to your API server, and nothing opens one to the agent.
Protocols
HTTPS and one WebSocket. The agent listens on no port.
Proxies
It works through the system proxy and through a configured one.
Reconnecting
It reconnects with backoff after a drop, and picks up pending work.
The printer network
It needs no inbound port, so nothing has to be opened on the firewall in front of the printers.

What the agent does with a job

  1. Receives itThe job arrives down the connection the agent opened.
  2. Checks the signatureThe server signs every job. The agent checks the signature before anything reaches a printer.
  3. Skips duplicatesDelivery is at-least-once, and the agent de-duplicates by job id, so a reconnect never prints a label twice.
  4. Writes it to the printerThe bytes go to the printer beside the agent, as in the table above. Color and non-thermal printers print through graphic mode instead.

The job's life stays visible on your API server while this happens:

  1. Queued
  2. Dispatched
  3. Received
  4. Spooled
  5. Printed
  • Failed
  • Canceled
  • Expired

When the agent is offline

Jobs for an agent that is not there do not fail at once, and they do not print twice when it comes back.

What happens to a print job in each situation: agent offline, job expiry, connection lost and retried requests
SituationWhat happens
A job is queued while the agent is offline It waits in the queue no longer than its expiry, which each tenant can set. When the agent reconnects, it picks up pending work.
The job reaches its expiry first A job can end as Expired. Decide how long a job is worth keeping: a pick label for yesterday's orders should not print this morning.
The agent is lost before it acknowledges a job The job goes back to Queued.
A job is delivered twice Delivery is at-least-once, so this can happen after a dropped connection. The agent de-duplicates by job id, so the label prints once.
Your code retries a request that timed out Print jobs honor an idempotency key, so a retried request does not queue a second label.

Revoking and updating

Revoking
Revoking an agent closes its live connection and refuses its tokens straight away. Tokens are short-lived and bound to the agent and the tenant.
Updating
Updates arrive as signed packages with staged rollout, and roll back if the new version fails to start.

Diagnosing a problem

A built-in diagnostic command checks connectivity, proxy, clock skew, enrollment and printer reachability, in Spanish or English. This is the shape of its output, illustrative only.

diagillustrative output
Connectivity ........ OK
Proxy ............... none
Clock skew .......... 0.3 s
Enrollment .......... paired
Printer 192.168.1.50:9100 ... reachable

Illustrative output. Wording and format are not final.

What the agent does not do

  • It opens no listening port. It only dials out.
  • It is not a bridge on a workstation. The browser never calls a port on your machine, and no bridge program is installed on the user's workstation.
  • It installs no printer drivers or firmware, and no fonts on its host.
  • It does not route through a printer maker's cloud. It writes to your printers directly.
  • The API server never writes to a printer. Only the agent, which sits next to the printers, does.
  • It does not add network printers on the server's say-so. Network printers created from the server side are off unless local policy allows them.
  • It does not send label data to BarcoderX. BarcoderX hosts nothing for you and keeps only the developer's account, license keys and the versions they may download.

Sources Everything this page says about BarcoderX comes from its published platform, printing, security, API, how-it-works and FAQ pages and its server-side and web-app printing guides.

Written by BarcoderX in its own words.