← 全部工具

Toshik1978/onepagepass

热度 75 更新于 测试与安全

CLI tool that repacks a PDF scan of a small document into a two-pages-per-A4 layout that's handier to print

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

One-page passport

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.

How it works

  • 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.

Install

go install github.com/Toshik1978/onepagepass/cmd@latest

Or build from source (requires Task):

task build      # produces bin/onepagepass

Usage

onepagepass 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.

Development

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 cache

See CLAUDE.md / AGENTS.md for contributor and agent onboarding notes.