Share this link via:
WhatsAppFacebookTwitter

Code to PDF Converter

Upload a source code file or paste code directly, choose light or dark theme, and export to a professionally formatted PDF with line numbers and syntax colouring.

Drag & drop any source code file here

or click to browse

.js .ts .py .java .go .rs .php .cs .rb .css .html .sql .sh + more

.pdf
📂

Upload or Paste Code

Upload any source code file or paste code directly

🎨

Syntax Highlighting

Language auto-detected, tokens colour-coded (dark/light)

🖨️

Save as PDF

Click convert and save from the browser print dialog

Supported Languages — click to select

How much did you enjoy Code to PDF Converter?

Related Tools

No data found – try searching with different keywords or check back later

Not Found

Convert Source Code to PDF Instantly

ToolSnak's Code to PDF Converter lets you turn any source code file into a beautifully styled, syntax-highlighted PDF. Perfect for code reviews, documentation, portfolio submissions, or printing code for interviews. Upload a file or paste directly — language is auto-detected from the file extension.

25+ Supported Programming Languages

JavaScript, TypeScript, JSX, TSX, Python, Java, Go, Rust, C#, C/C++, PHP, Ruby, Swift, Kotlin, Dart, CSS, SCSS, HTML, XML, SQL, Shell/Bash, YAML, TOML, JSON, Markdown, ENV and more. Each language uses accurate keyword sets, string detection, and comment parsing.

Key Features

  • 25+ programming languages with accurate syntax highlighting
  • Dark (GitHub-style) and Light themes
  • Line numbers on every page
  • Language badge & colour-coded header bar
  • Adjustable font size (6–13pt) and page format (A4, Letter, Legal, A3)
  • Portrait and Landscape orientation
  • Upload a file or paste code directly
  • True vector PDF — text is selectable and searchable
  • 100% browser-based, no server upload

How to Use

  1. Upload a source code file or switch to 'Paste Code' tab and paste your code.
  2. Select the programming language from the dropdown if needed.
  3. Choose theme (dark/light), font size, and page format in Settings.
  4. Click 'Convert to PDF & Download'.
  5. In the print dialog, select 'Save as PDF' to download.

Use Cases

Code to PDF is ideal for: sharing code snippets in a professional format, printing code for technical interviews, code review documentation, including source code in reports or portfolios, archiving code in a human-readable format, and creating printable cheat sheets.

Code to PDF Converter - Syntax Highlighted Source Code PDF | ToolSnak

Got Questions? We have you covered

The tool supports 25+ languages including JavaScript, TypeScript, Python, Java, Go, Rust, C#, C/C++, PHP, Ruby, Swift, Kotlin, Dart, CSS, SCSS, HTML, XML, SQL, Shell, YAML, TOML, JSON, Markdown, ENV files, and more.

When you upload a file, the language is auto-detected from the file extension (e.g., .py → Python, .ts → TypeScript). When pasting code manually, you can select the language from the dropdown.

Yes! The PDF is generated using your browser's native print engine, so all text is fully selectable, searchable, and copyable — not a screenshot.

Yes. The code will automatically flow across as many pages as needed. Page breaks are handled naturally by the browser's print layout engine.

Completely. All processing is done locally in your browser. Your source code is never uploaded to any server.

Yes! The Settings panel lets you choose between a GitHub-style dark theme and a clean light theme. The syntax colours adapt automatically to the selected theme.

Support ToolSnak’s Mission

ToolSnak is completely free — no sign-ups, no limits. Enjoy AI writing tools, OCR, and more with zero hassle. Want to help us grow? We love your support. Thank you!

Support ToolSnak’s mission with a donation — teamwork and coffee-powered tools
Code to PDF Converter - Syntax Highlighted Source Code PDF | ToolSnak