Skip to main content

Render source code files as landscape PDFs laid out as book spreads.

Project description

code-to-pdf

Render source code files into landscape PDFs formatted as book spreads — featuring two columns per page, line-number gutters, and a central spine line.

Perfect for printing readable code, preparing physical code reviews, or generating clean PDF documentation.


Features

  • Book-Spread Layout: Automatically formats code into two landscape columns per page separated by a spine gutter.
  • Syntax Highlighting: Uses Pygments for full language support (defaults to high-contrast black-and-white bw style optimized for printing).
  • Interactive REPL Mode (--repl): Interactive file and directory picker to quickly batch-convert or merge multiple files into a single PDF.
  • Git-Aware: Respects .gitignore rules automatically when picking files.
  • Smart Re-Indentation: Automatically detects existing code indentation (2, 3, 4 spaces) and re-indents to your desired tab stop.
  • Automatic Line Wrapping: Wraps long code lines gracefully without breaking token formatting.

Installation

From PyPI

pip install code-to-pdf

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haiz_code2pdf-0.1.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

haiz_code2pdf-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file haiz_code2pdf-0.1.0.tar.gz.

File metadata

  • Download URL: haiz_code2pdf-0.1.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for haiz_code2pdf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7c968b8ccfe0a931c9afef18b600f5ca51c2f1222f6abdf8cb8127f788343c67
MD5 204b72fbcde4fab6b6d11ed85083661a
BLAKE2b-256 c6b234ea516856b4d6653b4f94220e0f4b6f15ce675c6ca5a704c2bd8fc53507

See more details on using hashes here.

File details

Details for the file haiz_code2pdf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: haiz_code2pdf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for haiz_code2pdf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de96fc88e8cbf76338cd28fe83bc303cd7a3abc1f851d503cbb15df12fbbb610
MD5 1568cfc9d0c4ebec3e768cb4b74faf3e
BLAKE2b-256 5c45cd57ce3b630e6eb5839fbc8cf132f990b4184ed62d5e99d7622d6ee8b949

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page