Print.js: the print dialog call every web project ends up writing by hand
A tiny javascript library to help printing from the web.
At a glance
- What is it?
- A small JavaScript library to help printing from the web. The code is old, the API is one function, and all real documentation lives off the repository.
- Who is it for?
- Print.js is a reasonable answer to a small problem: browsers give you one print call and no way to control what appears in the print dialog. The library is small and MIT licensed.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 124 days ago.
- What is it written in?
- Mainly JavaScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- crabbly/Print.js4,544 ★ · -3
| Repository | 2026-10-07 | 2026-11-25 |
|---|---|---|
| crabbly/Print.js | 4.5k | 4.5k |
-3 Stars in the last 49 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
A tiny library whose README is mostly a pointer elsewhere
The README opens with one line: a tiny javascript library to help printing from the web. Everything after that is installation, contribution instructions and licence text, with a single line in between that says documentation and examples are at printjs.crabbly.com.
That is an honest arrangement rather than a thin one. The repository is the code, and printjs.crabbly.com is the manual, including a CDN section. It means evaluating the library takes two steps: read the repository for what it actually contains, then read the site for how you are meant to call it.
What the repository contains is small and legible. The tree is `.babelrc`, `karma.conf.js`, `webpack.config.js`, `bower.json`, `package.json`, a `src/` directory and a `test/` directory. There is no framework, no plugin system and no build output committed under version control beyond what `dist/print.js` implies as the published entry point. The project is MIT licensed and its homepage in `package.json` is printjs.crabbly.com.
Installing from npm, yarn, a release download or the CDN
Four routes are documented, and the README is explicit about each. From GitHub releases you can download the latest version, or you can take the Print.js CDN build listed on the documentation page.
The npm route is the ordinary one:
npm install print-js --saveand yarn is documented alongside it:
yarn add print-jsEither way you import a single default export:
import printJS from 'print-js'The published package is named `print-js`, while the repository, the library and the identifier are all `Print.js`, with the capital P and the capital J. The `package.json` sets `main` to `dist/print.js` and `types` to `src/index.d.ts`, so the TypeScript definitions ship from source rather than from the build output. If you are on a modern bundler, the import above is the whole integration.
What the release history says about the design
The GitHub releases are sparse, which is itself informative. The three listed are v1.6.0 from 2021-02-17, v1.5.0 from 2020-10-10 and v1.4.0 from 2020-09-26.
The `version` field in `package.json` still reads `1.6.0`, matching the newest release, even though the last push was on 2026-07-24.
The supported print shapes, as far as the repository reveals them
The README does not document the function signature or the options. For the exact option names and their defaults, the documentation site at printjs.crabbly.com is the place to look.
A dev environment built on Karma, Jasmine and webpack
The contribution section is more detailed than the usage section, and it describes a 2020 era toolchain. The library follows the JavaScript Standard style guide, and the README notes that running the tests also checks for style issues. Automated tests are written with Jasmine and run through Karma.
Setting up a dev environment takes two commands:
npm install
npm run watchand the automated tests are:
npm run testManual testing is separate, and the README is specific about what it does:
npm startThat serves `test/manual/test.html` and opens the manual page at `http://localhost:8080/test/manual` in your default browser. The manual fixture is more useful to a reader than the unit tests are, because it is the closest thing in the repository to a gallery of working print examples.
The dependency list confirms the vintage: webpack at `4.44.1`, `node-sass` at `4.14.1`, Karma at `5.2.1`, and `karma-phantomjs-launcher` still in devDependencies. `node-sass` in particular will fail to install on current Node versions, which is the practical obstacle anyone cloning this repository will hit first. Consumers who install the published package do not pay that cost.
Where Print.js stops and the print dialog takes over
The library's scope ends at the browser's print dialog. Whatever comes after that, saving to PDF, choosing a printer, changing margins, is the operating system's business.
This matters when you compare options. Libraries built on PDFKit or on a headless browser produce a file you can email or attach, which is a different requirement from printing what the user already sees. Print.js is for the case where the user has a printer or a print-to-PDF dialog and wants the right content to appear in it.
The comparison with the platform is worth making plainly. `window.print()` prints the current document and nothing else, which is why teams write the hidden-iframe trick themselves. Print.js is a packaged, MIT licensed library for this kind of printing. The value it adds is real but bounded, and you can read the whole of `src/` in a sitting.
Where it is genuinely behind is documentation. The repository sends you elsewhere for the reference, and there is no changelog file; the newest GitHub release is v1.6.0 from 2021.
Editorial conclusion
Print.js is a reasonable answer to a small problem: browsers give you one print call and no way to control what appears in the print dialog. The library is small and MIT licensed. It is a poor fit if you need PDF generation, since the browser print dialog and the PDF are two different problems, and a bad fit if you need current documentation, since the reference lives on printjs.crabbly.com rather than in the repository. Start with the single call signature, and read `test/manual/test.html` if you need to see what the supported print shapes look like.
Frequently asked questions
How do I print only one element of a page with Print.js?
The README does not document the call signature; documentation and examples are at printjs.crabbly.com.
How do I know when the user has closed the print dialog in Print.js?
The README does not document callbacks; check the documentation at printjs.crabbly.com.
Can Print.js generate a PDF file instead of opening the print dialog?
The README does not say; it describes Print.js only as a tiny library to help printing from the web, and the documentation at printjs.crabbly.com is the reference.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/crabbly-print-js)Star history chart for your README
[](https://hysenlabs.com/projects/crabbly-print-js)Was this useful?