# pressedslip > Compose printable slips from pre-built content blocks and send them directly to your thermal printer. [](https://www.npmjs.com/package/pressedslip) [](https://github.com/diegomarino/pressedslip/actions/workflows/ci.yml) [](https://opensource.org/licenses/MIT)  https://github.com/user-attachments/assets/9df1895b-349f-410e-99cd-5cff7bf11700 `pressedslip` lets you describe printable content as data, render it through React/Satori/resvg, inspect the resulting composition, and then save the PNG or send it to a transport. It is built for product dashboards, personal automation, briefing printers, embedded displays, and any workflow where receipt-like output should be generated from typed blocks instead of hand-built layout code. [Try the playground](https://diegomarino.github.io/pressedslip/) | [Read the docs](https://github.com/diegomarino/pressedslip/tree/main/docs) | [API overview](https://github.com/diegomarino/pressedslip/blob/main/docs/api/README.md) ## Install ```bash # pick one pnpm add pressedslip # or npm install pressedslip ``` `satori` pins `fflate@0.7.3`, which `npm audit` flags (`unzipSync` infinite loop; satori only calls `inflateSync`). A dependency of pressedslip cannot change that pin for you, so add an override in your own `package.json`: ```json { "overrides": { "fflate": "^0.7.5" }, "pnpm": { "overrides": { "fflate@>=0.7.0 <0.7.5": "^0.7.5" } } } ``` Use `overrides` for npm and Bun and `pnpm.overrides` (or `overrides` in `pnpm-workspace.yaml`) for pnpm. satori shapes text with `harfbuzzjs`, which loads `hb.wasm` from its own package directory. If you bundle a Node server (esbuild, Rollup) to ESM, keep `harfbuzzjs` external like `@resvg/resvg-js`; bundled, it fails at import with `ReferenceError: __dirname is not defined`. Browser bundles need the alias in [Browser rendering](https://github.com/diegomarino/pressedslip/blob/main/docs/guide/browser-rendering.md). ## Use with AI agents pressedslip ships an [agent skill](https://github.com/diegomarino/pressedslip/tree/main/skills/pressedslip) so coding agents (Claude Code, Cursor, Codex and others) can compose, render, check and print slips on their own. Install it in your project with: ```bash npx skills add diegomarino/pressedslip ``` Then ask for a slip in plain words ("a morning slip with the weather, a riddle and a word search"). The agent writes the slip JSON, renders it to a PNG, checks it for failed blocks and fixes them, and prints only if you ask. It doesn't need pressedslip in your project for builtin blocks. The skill includes a render script, a seeded word-search generator, a block catalogue, and data patterns adapted from a real household planner: live APIs, dates, calendars, streaks and emoji pictures. ## Quick Example ```ts import { render, createRegistry, builtinBlocks, loadThemeFonts, themes, PAPER, type CompositionInput, } from "pressedslip"; import { writeFile } from "node:fs/promises"; const registry = createRegistry(builtinBlocks); const theme = await loadThemeFonts(themes.default); const composition: CompositionInput = { id: "morning-brief", version: 1, date: new Date().toISOString().slice(0, 10), status: "ready", slots: [ { index: 0, blockType: "kpi", title: "WEATHER", data: { value: "18°C", label: "OLEIROS", caption: "Partly cloudy · low 13°C" }, }, { index: 1, blockType: "list", title: "CALENDAR", data: { groups: [ { title: "MORNING", items: [ { id: "09:00", value: "Weekly sync · Design × Eng" }, { id: "10:30", value: "1-on-1 with María" }, ], }, { title: "AFTERNOON", items: [ { id: "14:00", value: "Deep work block" }, { id: "16:45", value: "Product demo · Acme Corp" }, ], }, ], }, }, { index: 2, blockType: "quotation", title: "QUOTE", data: { text: "Make it work, make it right, make it fast.", attribution: "Kent Beck", }, }, { index: 3, blockType: "keyValue", title: "DAYLIGHT", data: { label: "Sunrise · Sunset", value: "06:22 · 21:04" }, }, ], }; const { bytes } = await render(composition, { registry, theme, width: PAPER.thermal80, }); await writeFile("morning-brief.png", bytes); ``` ## From data to paper Each slot is plain data. Builtin blocks cover the everyday cases. A theme override or a small [custom block](https://github.com/diegomarino/pressedslip/blob/main/docs/guide/custom-block-walkthrough.md) covers the rest. These three are from the [recipes](https://github.com/diegomarino/pressedslip/blob/main/docs/guide/recipes.md). The slips at the top of this page are in the [playground](https://diegomarino.github.io/pressedslip/) under **Example**, ready to edit.
| Slot data | Printed |
|---|---|
| **Phonics sound buttons** · custom block, [`phonics-demo.tsx`](https://github.com/diegomarino/pressedslip/blob/main/apps/playground/src/showcase-blocks/phonics-demo.tsx) ```jsonc { "blockType": "phonicsDemo", "title": "READ ME", "data": { "words": [ { "word": "ship", "graphemes": ["sh", "i", "p"] }, { "word": "night", "graphemes": ["n", "igh", "t"] }, { "word": "the", "graphemes": ["the"], "tricky": true } ] } } ``` The font fits the longest word to the paper, up to 160 px. A dot goes under each letter and a dash under each digraph. | ![]() |
| **Emoji checklist** · custom block reusing the builtin `image` block, [`routine-demo.tsx`](https://github.com/diegomarino/pressedslip/blob/main/apps/playground/src/showcase-blocks/routine-demo.tsx) ```jsonc { "blockType": "routineDemo", "title": "BEFORE SCHOOL", "data": { "items": [ { "text": "Brush teeth", "image": { "src": "data:image/png;base64,…" } }, { "text": "Wash hands", "image": { "src": "data:image/png;base64,…" } }, { "text": "Shoes on", "image": { "src": "data:image/png;base64,…" } }, { "text": "Backpack", "image": { "src": "data:image/png;base64,…" } } ] } } ``` Each emoji is rasterized to PNG so it gets dithered. Light colours survive the 1-bit output ([why](https://github.com/diegomarino/pressedslip/blob/main/docs/guide/recipes.md#printing-emoji)). | ![]() |
| **Upside-down riddle** · builtin `qaPair` with a theme override ```jsonc { "blockType": "qaPair", "title": "RIDDLE", "data": { "question": "What has hands but can't clap?", "answer": "A clock" } } // theme: shell.textStyles.answer = { rotate: 180 } ``` No custom code: the reader flips the paper to read the answer. | ![]() |