Skip to content

johnsmzr/Code-to-one-PDF

Repository files navigation

Code to PDF Converter 中文

Code to PDF Converter is a Python tool for converting source code files within a directory into a single PDF document, while allowing you to specify files and directories to exclude through a configuration file. This tool is particularly useful for developers who need to archive or send their code repositories to AI.

Features

  • Convert all source code files within a directory into a single PDF file.
  • Exclude specific files and directories using a configuration file.
  • Support custom file patterns using wildcards in the configuration.

Installation

To use this tool, you need to have Python installed on your system. Clone this repository and install the required dependencies:

git clone git@github.com:johnsmzr/Code-to-one-PDF.git 
cd Code-to-one-PDF 
pip install -r requirements.txt

Usage

Copy the compiled binary to the directory containing the code you want to convert to PDF, and run it:

./code-to-pdf

(Or manually run the Python code)

Configuration File

The configuration file .pdfignore.yml should be placed in the same directory. It specifies which files and directories to exclude. For example:

directories:
  - .git
  - log
files:
  - .DS_Store
patterns:
  - '*.pdf'
  - '*.tmp'

Compile to Binary

pyinstaller --onefile code-to-pdf.py

FAQ

Q: Can I exclude files based on their content?

A: Currently, exclusion is only based on file names and directory paths specified in the configuration file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages