This script helps you convert the content of a GitHub repository into a single PDF file. It is useful for feeding codebases to language models, printing code for review, or simply for archival purposes.
- Download a GitHub repository and convert it into a single PDF file
- Skip specified directories (e.g.,
node_modules
)
The script requires pdftk
, enscript
, and ps2pdf
to be installed on your system. The script will attempt to install the required packages automatically for macOS users using Homebrew. If you're on another platform, please install them manually before running the script.
- Clone the repository & enter it:
git clone https://github.com/kaifirschau/repo-to-pdf.git && cd repo-to-pdf
- Make the script executable:
chmod +x githubToPDF.sh
- Run the script with the repository URL and the -s flag followed by the directories you want to skip (separated by commas):
./githubToPDF.sh -r https://github.com/user/repo -s node_modules,other_directory
This command will download the specified repository and create a PDF file with the same name as the repository in your current directory.
This project is open source and available under the MIT License.