Open-source project
BankkRoll/repo2pdf avatar
BankkRoll/repo2pdf

repo2pdf prints a repository, one file per page or one file per PDF

repo2pdf 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. --- DOCS: https://bankkroll-repo2pdf.mintlify.app

381 stars75 forksJavaScriptMIT

At a glance

What is it?
BankkRoll/repo2pdf is a Node CLI that clones a repository or reads a local checkout and renders the text files into a PDF through pdfkit, with prompts for line numbers, page numbers, highlighting and comment stripping. The npm route asks three questions; the clone route asks nine.
Who is it for?
Good fit for teaching material, a review packet to hand to someone without a clone, or an archive of a tree you want to read offline, and the ignore file is what keeps that output usable. A poor fit for large repositories you have not tuned, because only some file types and directories are skipped by default and build output has to be added by hand.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 121 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 1, 2026, and from our analysis. They are not legal advice.

Editorial analysis

npx asks three questions, the clone route asks nine

The registry route is one command:

shell
npx repo2pdf

It downloads the latest published version and then asks for three things: the GitHub repository URL, the output file name, and whether to keep the cloned repository. That is the whole interaction.

The clone route is a different experience, because the feature prompts only exist there:

shell
git clone https://github.com/BankkRoll/repo2pdf
cd repo2pdf
npm install
npm run build
npm start

This path first asks whether to clone a repository or use a local one, and branches accordingly: a path for the local case, a URL for the remote case. Then comes a features checklist covering line numbers in the PDF, page numbers in the PDF, highlighting in the PDF, removing comments from the code, removing empty lines from the code, and whether to produce one file or one PDF per file. After that, a name for the output PDF file or output directory, and finally the same keep-or-delete question for the clone. Both routes need Node above 18, and git as well for anything that is not local.

The published entry point is dist/clone.js

The npm package is `repo2pdf` at version 2.2.9, and its executable is called `clone` rather than something more descriptive: both `main` and the `bin` entry point at `dist/clone.js`. The same name shows up in the styling answer later, where `clone.ts` is one of the two files to edit.

The build is TypeScript through tsc, with no bundler in the way. `npm run build` compiles, `npm run watch` is `tsc -w`, and `npm start` runs `node dist/clone.js` from the compiled output, which is why the clone route has a build step and the npx route does not. The published file list ships the `dist` directory plus LICENSE.md, README.md, package.json, package-lock.json, `repo2pdf.ignore` and `tsconfig.json`, so a consumer gets the ignore file template and the compiler settings alongside the binary.

repo2pdf.ignore is JSON, and build output is not on the default list

Some file types and directories are skipped without being asked about, with `.png` and `.git` given as the examples. Everything beyond that is the user's problem, which is what `repo2pdf.ignore` at the root of the repository is for:

json
{
  "ignoredFiles": ["tsconfig.json", "dist", "node_modules"],
  "ignoredExtensions": [".raw"]
}

The project is explicit that more directories have to be added by hand, because the script does not automatically ignore build files and directories of the kind your own project produces. That is the practical gap: a repository with `dist`, `build` or `node_modules` in it will print all of it unless you exclude it first. One more placement rule catches people out. With a remote URL the file lives at the root of the cloned repository, but with a local repository it has to sit at the root of that repository directory.

Text files go in, binaries are skipped

Supported input is every text-based file, and binary content such as images and compiled binaries is ignored. That split is not incidental to the dependency list: `isbinaryfile` is a runtime dependency, so the decision is made per file rather than by extension guesswork, and `strip-comments` is there because removing comments from the code is one of the checklist answers.

Syntax colouring comes from `highlight.js` at 11.9, `html-entities` handles escaping, `pdfkit` at 0.13 writes the document, `simple-git` does the cloning, `chalk` and `ora` colour the terminal output, and `inquirer` collects the prompts. Prettier is also a runtime dependency rather than a development one, even though its only script is `prettier --write .`, which is what `prepublishOnly` runs before building.

Styling is two source files you edit yourself

There is no configuration file for appearance. The answer to the styling question names the two files to change, `clone.ts` and `syntax.ts`, and the properties they control: font, font size, colours and the rest of the document styling options. The example given is a font size change in the syntax file:

typescript
// Example: Changing font size in syntax.ts
doc.fontSize(12);

So customising the output means forking or patching the source rather than passing flags, since the prompts cover content decisions and nothing about typography. If you want the same look across a batch of repositories, that edit has to be made once and then carried, because a published version of the package will keep whatever defaults it shipped with.

package.json still points at the Repo-to-PDF repository

The metadata has drifted from the repository it now lives in. The `repository` URL is `git+https://github.com/BankkRoll/Repo-to-PDF.git`, and the same older name appears in `homepage`, `documentation` and the `bugs` URL, all pointing at `Repo-to-PDF` and its issue tracker. The npm README meanwhile advertises repo2pdf.site as the website and a Mintlify documentation site, neither of which appears in the package file.

The keyword list carries the same history: `langchain`, `openai` and `chatgpt` sit alongside `github`, `repository`, `pdf`, `clone` and `nodejs`. Three contributors are credited by name in the file, and the licence is MIT with the licence text living in LICENSE.md rather than a bare LICENSE. None of this stops the tool working, but it does mean the npm page points a reader at a repository path that is not the one hosting the source.

The test script fails on purpose and never ships

The `test` script is the placeholder npm generates for a new package: it echoes `Error: no test specified` and exits with status 1. That means `npm test` always fails and there is no suite behind it. What does run before a publish is formatting and compiling: `prepublishOnly` is `npm run format && npm run build`, so `prettier --write .` rewrites the tree and then tsc produces `dist`. That ordering has a consequence for anyone cloning and building, since the format step is not run for you and a build on a differently configured formatter can produce different output than a publish would.

What the project does offer instead of tests is documentation. The troubleshooting section is a list of questions with direct answers, covering a failed package install, the styling question, supported file types, the ignore list, line numbers, keeping the clone, and generating from a local repository, plus a short contributing section that asks for reproduction steps, error messages, and your operating system and Node.js version in any bug report.

No tagged releases, and a web app for people without Node

There is no GitHub release history for this project, and the last commit on the default branch landed on 2 June 2026. The published npm package declares version 2.2.9, so that number is the only reference point for what you are running, and pinning it is the only way to keep a rerun reproducible.

For anyone who does not want a Node toolchain at all, the project points at a web app hosted at repo2pdf.site, alongside a separate documentation site. The two install paths remain the local story though: the npx route for a quick conversion of a remote repository, and the clone route for anything local, custom-styled, or built on repeated runs. Choosing between them is less about capability than about how many of the checklist answers you actually want to answer, since only the clone route offers them.

Editorial conclusion

Good fit for teaching material, a review packet to hand to someone without a clone, or an archive of a tree you want to read offline, and the ignore file is what keeps that output usable. A poor fit for large repositories you have not tuned, because only some file types and directories are skipped by default and build output has to be added by hand. Before a first run on real code, decide local or remote, put a repo2pdf.ignore at the root of whatever you are converting, and expect to style the output in clone.ts or syntax.ts if the default font size is not what you want. The package has no tagged release and the default branch last moved on 2 June 2026, so pin the npm version you tested rather than tracking the branch.

Frequently asked questions

How to convert GitHub repo to PDF?

Run npx repo2pdf and answer three prompts: the GitHub repository URL, the output file name, and whether to keep the cloned repository afterwards. The clone is done by simple-git and only text-based files are rendered, with images and compiled binaries ignored.

How to make a PDF of a project?

Clone the repository, run npm install, npm run build and npm start, then choose between cloning a remote repository and pointing at a local path. That route adds a features checklist for line numbers, page numbers, highlighting, stripping comments, stripping empty lines, and one file or one PDF per file. Node above 18 and git are required.

How to convert source code to PDF?

Source is coloured by highlight.js and written out by pdfkit, and comment stripping is one of the prompts. Output typography is not configured through a file: you edit the font, font size and colours in clone.ts or syntax.ts, for example calling doc.fontSize(12) in the syntax file.

Official sources

  1. BankkRoll/repo2pdf on GitHub
  2. Issues
  3. License: MIT
  4. Project website
  5. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/bankkroll-repo2pdf.svg)](https://hysenlabs.com/projects/bankkroll-repo2pdf)