Playground
The protocol-level debug console built into PrintLink: example centre, capability-driven options, controlled uploads and isolation.
Last updated
The Playground is embedded in PrintLink and shares the same local port as the service. It is aimed at developers validating connections, capabilities and printing flows.
Opening it
- Turn on Playground in console Settings (off by default).
- Visit
http://127.0.0.1:17888/(the port may differ). - Real printing is a separate switch, off by default — while it is off, examples only preview and validate.
What it does
- Example centre: each example states its purpose, required capabilities and expected result. The code shown is what actually runs.
- Capability-driven options: paper, duplex, colour and so on are read live from the selected printer and rebuilt when you switch printers. An offline printer is shown as unavailable rather than pretending to work.
- Mixed multi-page page (
/playground/mixed/): several content sources in one job, with recipe cards and a custom list, plus a status bar showing output pages and paper. - HTTP page (
/playground/http/): the only page that does not use the SDK. Every step is a realfetch, and matchingcurlcode is shown (tokens masked). Useful for mobile and server integration. - Hiprint page (
/playground/hiprint/): paste template JSON to see the conversion and its warnings.
Example code carries bilingual comments, and editor completions follow the UI language.
Local file uploads
The PDF and image examples let you pick a local file. They use the public asset upload interface (chunked with SHA-256 verification) — the same path your own pages use, with no privileged back door.
Isolation boundaries
The Playground executes code you type:
- It runs in a sandboxed iframe under a strict CSP and cannot reach desktop APIs or the parent page's DOM;
- But it calls the real local service, so it can do exactly what an authorised site can do.
Therefore: do not paste code you do not trust.
After a port change
When the port or listen scope changes in the console, open Playground pages are
notified and then stop issuing new requests, clear the stale connection intent,
and offer a reconnect entry pointing at the new address rather than retrying
against the old one. Your own pages can subscribe with
client.onServiceMigrated().