onepagepass

module
v0.0.0-...-b1c2048 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT

README

Build and Test Coverage Status

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

  1. The source PDF is rendered to images page by page via MuPDF (go-fitz).
  2. Consecutive pages are merged — the top half of page N+1 is placed into the bottom half of page N.
  3. 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.

License

See LICENSE.

Directories

Path Synopsis
Command onepagepass converts a PDF scan of a document into a two-pages-per-A4 layout that is handier to print.
Command onepagepass converts a PDF scan of a document into a two-pages-per-A4 layout that is handier to print.
pkg
converter
Package converter re-lays a rasterized PDF into a two-pages-per-A4 format.
Package converter re-lays a rasterized PDF into a two-pages-per-A4 format.
pdf
Package pdf wraps reading (MuPDF via go-fitz) and writing (gopdf) of PDF files.
Package pdf wraps reading (MuPDF via go-fitz) and writing (gopdf) of PDF files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL