@mhj6022/pdf-booklet-maker
v0.1.0
Published
CLI tool for duplicating PDF pages onto A4 sheets.
Maintainers
Readme
pdf-booklet-maker
pdf-booklet-maker is a command-line PDF layout tool for teachers, small publishers, churches, study groups, and anyone who repeatedly prepares printable handouts.
The project originally started as a Python-based saddle-stitch booklet helper. From this point forward, the main direction is a native Node.js CLI package that can be used through npm and npx.
The immediate goal is simple:
Take one PDF page and duplicate it onto an A4 sheet in useful print layouts.
The long-term goal is larger:
Build a practical, scriptable, open-source PDF imposition tool that can handle classroom handouts, mini cards, booklet printing, crop marks, printable grids, and eventually GUI/web workflows.
Package name
This project is intended to be published as:
@mhj6022/pdf-booklet-makerThe CLI command is fixed as:
pdf-booklet-makerExample final usage:
npx @mhj6022/pdf-booklet-maker input.pdf output.pdf --mode half
npx @mhj6022/pdf-booklet-maker input.pdf output.pdf --mode eighthWhy this project exists
Many teachers and document creators repeatedly need small but annoying PDF transformations:
- duplicate the same worksheet twice on one A4 page
- make 8 small copies of the same notice or card
- prepare mini test papers
- print vocabulary cards or Bible verse cards
- make cuttable classroom materials
- create booklet-style layouts
- add cut lines and crop marks
- automate the same layout from scripts, bots, or batch jobs
Large PDF editors can do some of this, but they are often slow, GUI-heavy, paid, or awkward to automate. This project aims to make these workflows available as simple CLI commands.
Current status
Early implementation stage.
The project is being rebuilt as a native Node.js CLI using:
- Node.js
pdf-libcommander
The old Python saddle-stitch workflow may remain as historical or legacy code, but the npm/npx-facing tool should not require users to install Python, pip, or virtual environments.
Phase 1: Minimum useful duplicate layouts
--mode half
Duplicate each input PDF page twice on one A4 page.
npx @mhj6022/pdf-booklet-maker input.pdf output.pdf --mode halfLayout:
┌──────────────┐
│ copy │
├──────────────┤
│ copy │
└──────────────┘Use cases:
- half-page handouts
- short quizzes
- compact notices
- classroom activity sheets
--mode eighth
Duplicate each input PDF page eight times on one A4 page using a 2 × 4 layout.
npx @mhj6022/pdf-booklet-maker input.pdf output.pdf --mode eighthLayout:
┌───────┬───────┐
│ copy │ copy │
├───────┼───────┤
│ copy │ copy │
├───────┼───────┤
│ copy │ copy │
├───────┼───────┤
│ copy │ copy │
└───────┴───────┘Use cases:
- mini cards
- memorization cards
- Bible verse cards
- vocabulary cards
- small tickets
- classroom feedback slips
Phase 2: General grid layout
Planned option:
pdf-booklet-maker input.pdf output.pdf --grid 2x4
pdf-booklet-maker input.pdf output.pdf --grid 1x2
pdf-booklet-maker input.pdf output.pdf --grid 3x3This generalizes half and eighth into arbitrary columns and rows.
Planned behavior:
--grid CxRExamples:
--grid 1x2: one column, two rows--grid 2x4: two columns, four rows--grid 4x4: four columns, four rows
Phase 3: Print-control options
Planned options:
--margin <points>
--gap <points>
--rotate auto|none|90|180|270
--fit contain|cover|stretchPurpose:
- control outer whitespace
- control space between duplicated items
- rotate pages to fit better
- preserve aspect ratio or fill cells
Phase 4: Cut lines and crop marks
Planned options:
--cut-line
--crop-mark
--registration-markUse cases:
- printable classroom cards
- cuttable memorization cards
- church handouts
- small group materials
- labels and slips
Possible future options:
--cut-line-style dashed
--cut-line-width 0.5
--crop-mark-length 10
--crop-mark-offset 3Phase 5: Booklet imposition
The project name is pdf-booklet-maker, so the long-term target includes true booklet imposition.
Example conceptual transformation:
Input reading order:
1, 2, 3, 4
Booklet print order:
4 | 1
2 | 3Planned modes:
--booklet
--saddle-stitch
--signature-size 4
--signature-size 8
--duplex short-edge|long-edgeUse cases:
- small booklets
- class reading packets
- church bulletins
- devotional booklets
- zines
- folded handouts
Phase 6: Batch automation
Planned features:
--input-dir ./pdfs
--output-dir ./out
--pattern "*.pdf"
--suffix "-8up"Use cases:
- batch convert many worksheets
- generate multiple classroom versions
- connect with Telegram bots or school automation scripts
- prepare weekly handouts automatically
Phase 7: GUI and web future
The CLI is the foundation. Later, the same core layout engine can power:
- Electron desktop app
- simple local web UI
- drag-and-drop browser version
- school document automation pipeline
- server-side batch service
The core principle is:
CLI first, reusable layout engine second, GUI later.
Installation
After npm publication:
npm install -g @mhj6022/pdf-booklet-makeror without installation:
npx @mhj6022/pdf-booklet-maker input.pdf output.pdf --mode halfLocal development
git clone https://github.com/rjegjin/pdf-booklet-maker.git
cd pdf-booklet-maker
npm install
npm testRun locally:
node src/cli.js input.pdf output.pdf --mode half
node src/cli.js input.pdf output.pdf --mode eighthOr link as a local command:
npm link
pdf-booklet-maker input.pdf output.pdf --mode halfFirst implementation target
The first working version should support only this API:
pdf-booklet-maker <input> <output> --mode half
pdf-booklet-maker <input> <output> --mode eighthNo extra options at first. The project should become reliable before becoming flexible.
Design principles
Simple command first
Common tasks should be one command.Predictable print output
A4 size, stable scaling, centered placement.No unnecessary dependencies
Keep the package small and portable.Automation-friendly
Every feature should be usable from scripts.Teacher-friendly
The tool should solve real classroom document problems, not only abstract PDF manipulation problems.Expandable architecture
halfandeighthare only shortcuts over a future general grid engine.
Roadmap summary
v0.1.0
- Node.js CLI package
- package name: @mhj6022/pdf-booklet-maker
- command: pdf-booklet-maker
- --mode half
- --mode eighth
v0.2.0
- --grid CxR
- basic validation
- better error messages
v0.3.0
- --margin
- --gap
- --rotate
- --fit
v0.4.0
- --cut-line
- --crop-mark
v0.5.0
- booklet imposition prototype
v1.0.0
- stable CLI
- duplicate layouts
- grid layouts
- print marks
- booklet mode
- documented examplesLegacy note
Earlier versions of this repository used a Python script such as:
python booklet_maker.pyThat workflow may remain useful for old saddle-stitch experiments, but the active npm package direction is Node.js.
License
MIT
