/repository-to-pdf

[Personal Project] Python program that converts your repository into a PDF file locally. It takes the information using argparse as mechanism of input. Besides, I used pdfkit and pygments as external libraries.

Primary LanguagePythonMIT LicenseMIT

Python Script that convert your repository to PDF
GitHub stars GitHub followers

⚈ About This

I decided to make this program because in cases where I work with projects in django, there are a lot of boring files and structures to follow. This is why I usually print the code to have it closer to me, but for this to happen, they have to go through a lot of copying and pasting. This is why I decided to convert my repositories to pdf.

⚈ Prerequisites

Git, Pip, Python (^3.8) installed and configured as environment variables.

1. Clone the Project

Execute the next command on your terminal

git clone https://github.com/Alfareiza/repository-to-pdf.git

2. Isolate the environment

Once the repository has been cloned, a folder is created with the name of the project repository-to-pdf.

Go toward this folder using the terminal :

cd repository-to-pdf

And execute:

python -m venv .venv

Then to activate the isolated environment execute the next command according to your O.S

Windows Linux
.venv\Scripts\activate source .venv/bin/activate

Finally, execute:

pip install -r requirements.txt

All the dependencies and sub-dependencies will be installed on the local project.

⚈ How to use it

Once the environment has been isolated, you can execute the program through the terminal.

So, for the magic to happen, execute the next command:

python -m generate_pdf.py {path_of_the_directory}

Examples:

    python generate_pdf.py --style tango /home/alfonso/PycharmProjects/blog/

    python generate_pdf.py /home/alfonso/PycharmProjects/colombian_newspapers

    python -m generate_pdf /home/alfonso/PycharmProjects/xml-to-json
    
    python generate_pdf.py C:\Users\Alfonso\PycharmProjects\ScrappingColombianNewspapers

In case you want to change the theme, you can choose it from the next list:

  • bw
  • sas
  • xcode
  • autumn
  • borland
  • arduino
  • igor
  • lovelace
  • pastie
  • rainbow_dash
  • emacs
  • tango
  • colorful
  • rrt
  • algol
  • abap