Skip to content

Toshik1978/onepagepass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages