Git2pdf
git2pdf is a tool that allows you to convert a GitHub repository into a PDF file. It clones the repository, processes the files, and then creates a PDF.
Install / Use
/learn @jordanburke/Git2pdfREADME
git2pdf
A powerful CLI tool for generating PDF documents from GitHub repositories with enhanced functionality.
What's New in 2.4.0
🎨 Improved Code Formatting
We've completely rewritten the syntax highlighting parser to fix a critical bug that caused code to render as an unreadable blob. PDFs now display beautifully formatted code with proper spacing, indentation, and syntax highlighting!

Key improvements:
- ✅ Proper whitespace and token spacing preserved
- ✅ Correct indentation maintained
- ✅ Syntax highlighting colors applied accurately
- ✅ Line numbers aligned properly
- ✅ Sequential token order matches source code
Overview
git2pdf is a versatile command-line tool designed to transform GitHub repositories into well-formatted, visually engaging PDF files. This tool automates the process of cloning repositories and parsing code files, serving various use cases including:
- Code reviews and documentation
- Offline reference materials
- Teaching materials
- Technical documentation
- Code archiving
- Integration with AI systems
Installation and Usage
git2pdf can be installed using NPM:
npm install -g git2pdf
Or used directly with NPX:
npx git2pdf
Usage
git2pdf [repository] [options]
Options
-l, --local: Use a local repository-o, --output <file>: Output file name (default: output.pdf)-d, --dir <directory>: Output directory for individual PDFs (default: ./output)-f, --file <path>: Specific file or directory path within the repository to process--line-numbers: Add line numbers to code in PDF--highlighting: Add syntax highlighting in PDF--page-numbers: Add page numbers to PDF--remove-comments: Remove comments from code--remove-empty: Remove empty lines--split: Generate one PDF per file--keep-repo: Keep cloned repository after processing-h, --help: Display help information-V, --version: Display version number
Examples
Generate a PDF from a GitHub repository:
git2pdf https://github.com/user/repo
Generate a PDF with line numbers and syntax highlighting:
git2pdf https://github.com/user/repo --line-numbers --highlighting
Use a local repository:
git2pdf -l ./my-local-repo --output my-docs.pdf
Create separate PDFs for each file:
git2pdf https://github.com/user/repo --split --dir ./output
Process only a specific file or directory:
git2pdf https://github.com/user/repo --file src/components
Configuration
git2pdf automatically ignores certain file types and directories (e.g.,
.png, .git).
To customize the files and directories to ignore, you can add a
git2pdf.ignore file to the root of your repository:
{
"ignoredFiles": ["tsconfig.json", "dist", "node_modules"],
"ignoredExtensions": [".raw"]
}
Requirements
- Node.js >= 18.0.0
- Git (for non-local repositories)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
This project is a fork of the original [repo2pdf](https://github.com/ BankkRoll/repo2pdf) by BankkRoll, with enhanced CLI functionality and improvements.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
