Code to PDF

Paste source code or HTML and get a clean, paginated PDF with line numbers, tab expansion and a title — no file upload needed.

PremiumIn-browser processing25 MB / file200 pages
Code to PDF is a premium tool. Upgrade to unlock it, higher file limits and an ad-free experience.

About Code to PDF

Code to PDF turns pasted code or markup into a printable document. In code mode the text is laid out in a monospaced font with optional line numbers, tabs expanded to four spaces, long lines wrapped at the page width and a header on every page. Choose the language for the header label and the file name, or pick HTML markup mode to have the pasted HTML parsed into headings, paragraphs, lists and code blocks. Page size, orientation, font size and margins are configurable, and the document title becomes the PDF title. Everything is rendered locally, so proprietary code never leaves your browser.

How to use Code to PDF

  1. Paste the code or HTML into the editor — no file upload is needed.
  2. Choose the content type (a language label, or HTML markup mode) and a document title.
  3. Set the font size, line numbers, page size, orientation and margin.
  4. Generate the PDF and download it.

Supported formats, limits and processing

  • Input: Pasted text (code or HTML)
  • Output: PDF
  • Processing: entirely in your browser. Files are never uploaded.
  • Limits: up to 25 MB per file, 10 files per job, 200 pages. Plan limits may be higher.

Privacy and file handling

This tool uses JavaScript and WebAssembly inside your browser. Your document is read locally, the output is created locally, and no file content is transmitted to our servers. Only an anonymous usage event (tool name and status, never the filename or content) may be recorded to measure reliability.

Troubleshooting

The PDF is rejected as empty
Paste the code first. Whitespace-only input is rejected instead of producing a blank page.
Long lines run into the margin
Long lines are wrapped at the printable width. Increase the page size or reduce the font size for very dense code.

Code to PDF FAQ

Is the code uploaded to a server?
No. The document is typeset inside your browser, which matters for proprietary source code.
Is there syntax highlighting?
No. The code is laid out in a monospaced font with line numbers, without colouring tokens. The language selection sets the header label and the file name.
What does HTML mode do?
It parses the pasted markup for headings, paragraphs, lists and code blocks and renders that structure. CSS, JavaScript and remote assets are not fetched or executed.
How much text can I convert?
Up to 400,000 characters per run. Longer content is rejected instead of being silently truncated.

Related tools

More Document Generation tools