Code to PDF Converter

Turn source code files into clean, readable PDFs. Upload your file, customize language highlighting, line numbers, and layout, then download your PDF.

Drag & Drop your code file here

or click to browse from your computer

.php .py .js .cs and others

Up to 200 KB · Processed privately

Browser extension

Keep RizCraft tools one click away

Open 24 built-in tools from your browser sidebar, use quick actions from the right-click menu, and reach every RizCraft tool without hunting through tabs.

Firefox and Edge versions are coming next. Free to install

Free Online Code to PDF Converter

Export source code to PDF with syntax highlighting and optional line numbers. Upload a PHP, Python, JavaScript, TypeScript, C#, Java, C, C++, Go, Rust, Ruby, SQL, HTML, CSS, JSON, or shell file, pick layout options, and download a readable listing for reviews, coursework, or documentation.

Language is detected from the file extension, and you can override it in the toolbar. For rendered Markdown documents use Markdown to PDF. To write or paste prose with a rich-text toolbar, use Text to PDF.

How to convert source code to PDF

  1. 1

    Upload a source file

    Drop a supported code file into the upload area. Limits are 200 KB and 2,000 lines. Processing stays on your device.

  2. 2

    Confirm language and layout

    Keep the auto-detected language or choose another. Set paper size, orientation, margins, font size, color or mono style, and line numbers.

  3. 3

    Download the PDF

    Click Convert to PDF to generate a searchable, print-ready listing. The converter does not reformat or compile your code.

  4. 4

    Share a readable listing

    Use landscape or a smaller font for long lines. Line numbers follow original source lines, even when a line wraps on the page.

Syntax highlighting and line numbers

Comments, keywords, strings, and other tokens use language-aware colors. Switch to mono for economical printing. Turn line numbers off if you only need the code. Changing the language dropdown never edits the file — it only changes highlighting.

Supported languages and file types

Convert .php, .py, .js, .ts, .cs, .java, .c, .cpp, .go, .rs, .rb, .sql, .sh, HTML, XML, CSS, JSON, and plain text. Wide listings wrap to the page width; landscape orientation gives more room for long lines.

Private source-code export

Your file is converted in the browser. RizCraft does not store, log, or inspect source code or the generated PDF. The tool is free, requires no account, and does not add a watermark.

Frequently Asked Questions

Can I convert PHP, Python, JavaScript, and C# files to PDF?
Yes. Upload a .php, .py, .js, .cs, or any other supported file. The language is automatically detected, and you can download a formatted PDF.
Can I show or hide line numbers in the PDF?
Yes. Use the "Show line numbers in PDF" checkbox to include or remove line numbers in the exported PDF.
What happens to long lines and indentation?
Spaces and indentation are preserved. Long lines wrap cleanly to the page width without adding new source line numbers. Use landscape orientation or a smaller font for wide code listings.
Does changing the language modify my code?
No. It changes syntax highlighting colors only. The converter never modifies, reformats, or compiles your code.
What file size is supported?
You can upload UTF-8 text files up to 200 KB and 2,000 lines. Choose A4, Letter, or Legal paper, portrait or landscape orientation, 10 to 25 mm margins, and 9 to 14 pt text.
Is this converter free, and do I need an account?
The converter is free to use and does not require an account. Exported PDFs do not have a watermark.
Where is my document processed?
Your file is processed in your browser and securely compiled into a PDF. Your documents and source code are never stored on our servers.