Real, runnable examples of printing from web apps — native browser printing and silent local printing via PortixOne, across frameworks.
See also: awesome-web-printing (ecosystem reference) · escpos-cheatsheet (thermal printer commands).
| Example | Stack | What it shows |
|---|---|---|
vanilla-js/window-print |
Plain HTML/CSS | Native window.print(), printing only one element via @media print |
vanilla-js/portixone-fetch |
Plain HTML/JS | Silent printing with a raw fetch() call — no SDK, no dialog |
react/print-button |
React + Vite + TS | Silent printing via a usePortixPrint hook |
vue/print-button |
Vue 3 + Vite + TS | Silent printing via the Composition API |
window.print() (the vanilla-js/window-print example) works everywhere, no setup — but it always shows the OS print dialog and can't pick a printer or print without user interaction.
For silent printing (no dialog, specific printer, works from a kiosk/POS), you need a local bridge. The other three examples talk directly to the PortixOne runtime — a small local process that receives print jobs over HTTP and sends them to a real printer.
- Clone and run the runtime: see
portixone/runtime/README.md. - Open
vanilla-js/portixone-fetch/index.htmldirectly, ornpm install && npm run devinsidereact/print-button/vue/print-button.
@portixone/sdk-jsisn't published to npm yet — every example here uses plainfetch()against the runtime's local HTTP API, which is exactly what the SDK does under the hood.
More frameworks (Svelte, Angular, Next.js) and more printing patterns (labels, barcodes, kitchen tickets) are welcome — open a PR.
MIT