git2pdf: Turn a GitHub Repo Into a Readable PDF
git2pdf 2.4.0 is out, with a rewritten syntax-highlighting engine. It's a CLI that clones a repository and renders it as a well-formatted PDF—handy for code review, offline reference, teaching, and feeding code to AI systems.
Sometimes you want a whole codebase as a single, readable document—for a review on a plane, a teaching handout, an archive, or to hand a chunk of code to an AI system in one shot.
git2pdf is a small CLI that does exactly that. Point it at a GitHub repository and it clones it, parses the source files, and produces a nicely formatted PDF.
npx git2pdf [repository] [options]
The flags cover the things you actually reach for: --highlighting for syntax highlighting, --line-numbers, --page-numbers, --split to emit one PDF per file, and --remove-comments / --remove-empty to strip noise. You can also point at a local repo with --local or a specific path inside it with --file.
The headline of this 2.4.0 release is a full rewrite of the syntax-highlighting parser, fixing a nasty bug that rendered code as an unreadable blob. Spacing, indentation, highlight colors, and line-number alignment now all survive the trip to PDF—which sounds mundane until it’s your code that came out as mush.
Install it globally with npm install -g git2pdf, or just run it through npx.