Code to PDF

Convert source code to a searchable PDF in your browser.

PDFy turns a folder of code into a single PDF with syntax highlighting, optional line numbers, a cover page, and a table of contents. Free, open source, runs locally, nothing gets uploaded.

No upload  ·  No install  ·  No signup

Source code is awkward to share outside of a code editor. Email clients mangle it. Screenshots aren't searchable. Word processors strip the formatting. The simplest portable format is still a PDF, and the simplest way to make a good code PDF is to point a tool at your project folder and let it do the layout for you.

PDFy is that tool. It runs entirely in your browser, reads your folder using the File System Access API, and produces a single searchable PDF: real text with syntax highlighting, paginated so long lines don't break, with a cover page and table of contents if you want them.

The sections below cover who reaches for PDFy, what makes the output worth using, and the questions people ask before they try it.

Submit a coding assignment as a PDF

Most computer-science programs accept (or require) coding assignments to be submitted as a PDF. PDFy is built for exactly this. Open the project folder, tick every file you want included, add a cover page with your name and the assignment title, and print to PDF.

  • Syntax highlighting for over 200 languages including Python, Java, JavaScript, C++, and Rust.
  • Optional line numbers per file, useful when the grader wants to refer to specific lines.
  • Cover page and table of contents are click-to-edit, so the front matter looks the way you want without external tools.
  • Files never leave your machine. Safe for graded submissions and for projects under an academic-honesty policy.

Step-by-step: Open a folderPick what to printCover pageSave the PDF.

Share a project for review or as a handout

Reviewers, mentors, and students don't always want to clone a repository to look at the code. A single PDF is easier to circulate, comment on, and read offline. PDFy generates handout-quality output: real text with syntax highlighting, page numbers, optional line numbers, and a header / footer that can include the project name, the current path, and the page number.

Headers and footers use Mustache templating, so a handout for a class can show the course name on every page, while a review document can show the file path and the commit. Reorder files in the print plan to put the most important ones first.

Customise: Headers and footersTemplating variablesPer-file overrides.

Archive a repository as a single PDF

A PDF snapshot is a useful complement to a Git tag. It freezes a project's source as a single readable artifact: no clone, no checkout, no toolchain required to read it later. Useful before deleting a workspace, before archiving an old client project, or before a major rewrite.

PDFy respects .gitignore by default, so the archive doesn't include node_modules, build/, or anything else your repo already ignores. The output is plain searchable text, so a future you (or a future tool) can grep, copy, and re-extract code from the PDF.

See also: Settings for the gitignore toggle, and Table of contents for navigation.

Send a portfolio project to a recruiter

Some companies ask candidates to submit a code sample as a PDF rather than a link to a repository. PDFy makes this trivial: pick the relevant files, put a cover page on it with your name and the project's elevator pitch, and export. The result is a single file you can attach to an application or email.

The print plan is independent of the on-disk layout, so you can hide or omit anything irrelevant (test scaffolding, generated config, throwaway prototypes) without touching the underlying repository. Custom titles per file let you label sections like "Core algorithm" or "API client" instead of bare filenames.

What makes the output good

  • Searchable text, not screenshots. The output is real text. You can copy lines out of it, grep it from the command line, and let any PDF reader's find feature work normally.
  • Wrap-aware pagination. Long lines break cleanly across pages instead of disappearing off the right margin. No surprise truncation in the printed file.
  • Syntax highlighting that actually prints. Powered by Shiki, the same highlighter used by VS Code's Twoslash. Over 200 languages, with both light and dark themes.
  • Customisable cover, TOC, headers and footers. Click-to-edit cover and TOC titles. Six header / footer slots accept Mustache templates with variables for title, page, path, and date.
  • Per-file overrides. Toggle line numbers, change the displayed title, scale embedded images, control alignment, all without touching the underlying file.
  • Privacy-first. The browser reads your folder. No upload, no third-party processing, no telemetry tied to file contents.

FAQ

More questions on the main FAQ.

  • How do I convert a folder of source code to a PDF? +

    Open PDFy, click Open folder, pick the project folder you want, tick the files in the print plan, and click Print to save the PDF. Everything runs in your browser, no upload, no install. The output is a single searchable PDF with syntax highlighting for over 200 programming languages.

  • Is this code to PDF converter free? +

    Yes. PDFy is free forever, open source under GPL v3, and there is no signup, no email, and no paywall. The code is on GitHub if you want to inspect or self-host it.

  • Can I use this to submit a coding assignment as a PDF? +

    Yes. PDFy is widely used for coding assignment submissions. The output is searchable, includes syntax highlighting, line numbers (optional), a cover page with your name and project title, and a table of contents. Most professors and graders accept this format directly.

  • Does PDFy upload my code anywhere? +

    No. PDFy uses the browser's File System Access API to read your folder locally and the browser's print dialog to produce the PDF. No file content ever leaves your machine. There is no server-side processing.

  • Which programming languages does the syntax highlighter support? +

    PDFy uses Shiki under the hood. It supports over 200 languages including Python, JavaScript, TypeScript, Java, C, C++, C#, Go, Rust, Ruby, PHP, Swift, Kotlin, Scala, Shell, SQL, HTML, CSS, JSON, YAML, Markdown, and many more.

  • Can I convert a GitHub repository to PDF? +

    Yes. Clone the repository to your machine first, then open the cloned folder in PDFy. PDFy works on any local folder, including the working copy of any Git repository. By default it respects .gitignore so node_modules and build artefacts are skipped.

The whole workflow

Code to PDF, in three clicks.

Step 1

Open a project folder

Pick a local folder. PDFy reads it without uploading anything.

Step 2

Pick which files to include

Reorder, rename, add or remove files in the print plan.

Step 3

Save as PDF

Click Print, choose Save as PDF in the browser dialog.

Ready to convert your code to PDF?

A folder, a click, a PDF. Free forever, runs in your browser.