CLI tool that repacks a PDF scan of a small document into a "two-pages-per-A4" layout that is handier to print.
If you have a passport (or any other document) that is smaller than A5, a plain scan wastes half the sheet
when printed. onepagepass rasterizes the source PDF and stacks the top half of each page on top of the next,
so two document pages share a single A4 sheet.
- The source PDF is rendered to images page by page via MuPDF (
go-fitz). - Consecutive pages are merged — the top half of page N+1 is placed into the bottom half of page N.
- The merged pages are written to a new A4 PDF via
gopdf.
The result is saved next to the source as <name>.converted.pdf.
go install github.com/Toshik1978/onepagepass/cmd@latestOr build from source (requires Task):
task build # produces bin/onepagepassonepagepass convert --pdf passport.pdf| Flag | Required | Default | Description |
|---|---|---|---|
--pdf |
yes | — | Path to the source PDF file. |
--dpi |
no | 300 |
Rasterization resolution in DPI. |
Run onepagepass --help or onepagepass convert --help for the full reference.
All automation is driven by Taskfile.yml:
task setup # download Go module dependencies
task lint # run golangci-lint
task test # run unit tests
task test:coverage # tests with race detector + coverage profile
task format # gofumpt/gci/golines + golangci-lint --fix
task build # compile bin/onepagepass
task clean # remove build artifacts and test cacheSee CLAUDE.md / AGENTS.md for contributor and agent onboarding notes.
See LICENSE.