Client-side printing you can aim: real paginated sheets with numbers and borders, a region tool that prints what you drew, redaction that is verified rather than hoped for, and a right-click menu, command palette and keyboard commands that are there the moment the script loads.
Runs in any browser with afterprint and document.fonts: Chrome, Edge, Firefox and Safari, current and two back. TypeScript source, zero runtime dependencies, ESM + UMD builds, and a command line for CI.
Try the demo: every job, the interaction layer and the inspector, with nothing to install.
npm install @simtabi/printcraftimport Printcraft from '@simtabi/printcraft'; // esm
const Printcraft = require('@simtabi/printcraft'); // cjs (umd build)Or a script tag. The UMD build sets a Printcraft global and boots the
declarative layer automatically:
<script src="printcraft.umd.js"></script>
<button data-printcraft="#invoice">Print</button>Full documentation: https://opensource.simtabi.com/documentation/simtabi/printcraft-js/
- Installation — package, script tag, and build output
- Demo — where to run it, and how its assets are built
- Getting started — your first job, in each of the three surfaces
- Surfaces — imperative, declarative, and JSON config
- Configuration — page defaults, config files, content annotations
- Architecture — the pipeline, the module layout, and why it is shaped this way
- Pagination — real sheets, page numbers, borders and running bands
- Security — the threat model, and what redaction guarantees
- Print backends — sending a job to a server or a companion service
- Comparison — lineage from ezPrintJS, and what changed
- Release — versioning and the publish process
- Options — every option, grouped by concern
- Events — the job lifecycle, hooks, and cancellation
- Redaction — destructive, declassified-file bars
- Privacy — the PII scanner
- Printer marks — crop marks and bleed
- Annotations — note chips in the print copy
- Clip printing — printing an exact rectangle
- Watermarks — text and image watermarks
- The interaction layer — actions, menu, command palette, keyboard, theming
- The component kit — modals, menus, forms, toasts, tooltips, popovers
- Sharing — screenshots, clipboard and email
- Errors and logging — codes, levels, sinks and events
- The command line — print, doctor and init, for CI
- Devtools — the inspector, the debug log, job records
- Print an invoice
- Redact before printing
- Draw a print area
- Crop marks for press
- Page defaults from JSON
- Override Ctrl+P
Questions and ideas belong in GitHub Discussions; bugs in Issues.
See CONTRIBUTING.md for local setup and conventions, and SECURITY.md to report a vulnerability privately.
MIT. A clean-room reimplementation and extension of the public API of ezPrintJS v1.1.0 (2017); no code from that commercial library was used. Icon artwork from Tabler Icons (MIT).