npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bookletize

v0.1.0

Published

Turn ordinary PDFs into press-ready folded booklets — saddle and tri-fold imposition with fold guides.

Downloads

9

Readme

bookletize

Turn ordinary PDFs into press-ready folded booklets.

CI

bookletize reorders and places the pages of a PDF so that when you print it duplex, fold it, and (optionally) staple it, the pages read in the right order. That's imposition — the oldest problem in printing, and somehow still unsolved on npm.

An 8-page half-letter booklet on two letter sheets:

  sheet 1  front: [ 8 │ 1 ]      back: [ 2 │ 7 ]
  sheet 2  front: [ 6 │ 3 ]      back: [ 4 │ 5 ]

Fold the stack in half → pages 1,2,3,4,5,6,7,8. Magic, but it's just arithmetic:
  sheet s of N pages (N a multiple of 4, 0-indexed):
  front: [ N−2s, 1+2s ]   back: [ 2+2s, N−1−2s ]
  • Zero-dependency core. The mappings are pure functions: page count in, sheet layout out.
  • Optional PDF applier. The bookletize/pdf entry point applies a mapping to real PDF bytes (via @cantoo/pdf-lib, a maintained pdf-lib fork), draws dashed fold guides, and pads to a multiple of 4 with blanks.
  • Golden-file tested. Every mapping is locked by tests; the letter-size layouts have been print-verified on physical duplex printers.
  • MIT licensed.

Install

npm install bookletize        # pnpm add / yarn add / bun add

CLI

# Half-letter saddle booklet on letter landscape sheets:
npx bookletize booklet service.pdf -o booklet.pdf

# Letter tri-fold (outside panels 5,6,1 / inside 2,3,4, with flap allowance):
npx bookletize trifold flyer.pdf -o trifold.pdf

Options: --sheet letter-landscape|legal-landscape (booklet), --no-guides, -o/--out (defaults to <input>.<command>.pdf).

Then print duplex, "flip on short edge" for booklets. (This one printer-dialog setting causes more upside-down back pages than everything else combined — see PRINTING.md.)

API

import { imposeSaddle } from "bookletize";

// Pure math — which logical page lands on which sheet face and slot.
// Pads to a multiple of 4; blank (padding) slots are null.
const sheets = imposeSaddle(5);
// → [
//     { front: [null, 1], back: [2, null] },   // pages 6–8 of the padded book are blank
//     { front: [null, 3], back: [4, 5] },
//   ]
import { applySaddle } from "bookletize/pdf";

// Real PDFs in, imposed sheet faces out (Uint8Array).
const bytes = await applySaddle(pdfBytes, {
  sheet: "letter-landscape",   // or "legal-landscape", or { width, height } in points
  foldGuides: true,            // dashed tick marks on the spine (default true)
});

Lower-level entry points (imposeSaddlePdf, imposeTrifoldPdf, SHEETS, TRIFOLD_LETTER) are exported from bookletize/pdf for callers who already hold a PDFDocument.

What it does / doesn't do

| Does | Doesn't | |---|---| | Saddle-fold booklets (half-letter, half-legal) | Render or lay out your content | | Tri-folds with correct narrow-flap allowance | Edit PDF content | | Fold guides, blank padding, page-slot math | Compress, encrypt, or sign PDFs | | (v0.2) crop marks, bleed, creep compensation, A4/A5, cut-and-stack | Anything that isn't imposition |

That last row is a promise: scope is imposition only. Issues asking for rendering or layout features will be closed kindly. This keeps the library small enough to trust and small enough for one maintainer to keep excellent.

Why this exists

We build QuickBulletins, which turns church worship bulletins into folded, stapled booklets every week. The imposition layer had no home on npm — prepress RIP software costs four figures and the classic desktop tools are abandoned — so we extracted ours. If you're printing zines, concert programs, wedding orders of service, or school booklets: it's the same arithmetic. Enjoy.

Roadmap

  • 0.1 — saddle + tri-fold (letter/legal), CLI, fold guides ← you are here
  • 0.2 — A4/A5, cut-and-stack, 2-up, crop marks + bleed, creep/shingling compensation
  • 0.3 — browser build + a free in-browser Booklet this PDF tool (your PDF never leaves your machine)
  • 1.0 — API freeze, semver promise

License

MIT © Heavenly Technologies LLC