Print school visitor passes automatically
When a visitor is signed in, print a pass on the office printer. The front-desk page calls your server, not the printer.
For School front offices
Overview
The office signs a visitor in and needs a pass with the name, host, and time. Render a small PDF and send it to the office printer_code. Do not put an API key in the sign-in iPad's browser.
The office PC that already prints letters can run the agent. A label printer is optional. Match the PDF to the paper you actually loaded.
Keep the pass content as small as the school requires. The print API is not a visitor-management product.
Create the job with POST /v1/print-jobs, an Authorization: Bearer header, printer_code, content_type pdf or raw, and exactly one of content or content_url. The free plan is 100 jobs a month on one computer.
Integration steps
- 01
Decide the printer before the click
Map the station, store, or line to a printer_code from GET /v1/printers. Do not ask the operator to pick a dialog.
- 02
Create the document in your system
PDF for driver printers, raw ZPL or ESC/POS when the device speaks that language.
- 03
POST when the business event happens
Pack, pay, check-in, or scan. Not on every autosave. Use the business id as Idempotency-Key.
- 04
Show the job result where the work is
queued is not done. Surface AGENT_OFFLINE and PRINT_ERROR to the person at the bench.
Node.js
// Visitor pass PDF
const res = await fetch('https://api.printbase.cloud/v1/print-jobs', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PRINTBASE_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': idempotencyKey,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'pdf',
content: pdf.toString('base64'),
copies: 1,
}),
});
if (!res.ok) throw new Error(`PrintBase ${res.status}: ${await res.text()}`);
const job = await res.json();
// { id: "job_abc", status: "queued" }
Details for this setup
iPad kiosk
The tablet calls your HTTPS API. Your API prints. The agent prints only what you send; it does not fetch the document from the platform for you.
End of day
You do not need to delete jobs to delete passes. Follow your own retention for the visitor record.
Questions
Is student data in the API?
Only if you put it in the PDF. Send the minimum the pass needs.
Printer in another room?
Use that room's computer and code. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
After hours?
If the office PC is off, the job fails with AGENT_OFFLINE. Print when staff turn it on, with a new key if the first job failed.
Color letterhead?
Only if the driver and the PDF include it. The API does not add a template.
Free plan: 100 jobs a month on one computer, no card.