Skip to content

dgrimaldi92/pdf-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 PDF Generator

A lightweight Python project to generate optimized PDFs from image archives.
It extracts .jpg files from a .7z archive, resizes them to fit an A4 page, and combines them into a single PDF.


🚀 Features

  • Extract .jpg images from .7z archives
  • Resize/compress images for smaller PDF size
  • Generate full-page PDFs with fpdf2
  • Logging with loguru
  • Modern dependency & linting setup with uv

📦 Installation

This project uses uv (a fast Python package/dependency manager).
Make sure you have it installed:

pip install uv

Then, install dependencies:

uv sync

This will create and manage a .venv automatically.


▶️ Usage

Run the PDF generator:

uv run main.py

(or whatever entrypoint you use — adjust the path accordingly).

The script will:

  1. Extract images from input.7z into the ./images folder
  2. Resize them to fit an A4 page (at ~150 DPI)
  3. Generate output.pdf in the project root

🛠 Development

Run linting and auto-fixes with ruff:

uv run ruff check --fix

Format code:

uv run ruff format

📂 Project Structure

pdf-generator/
├── pyproject.toml   # Dependencies & project config
├── README.md        # Documentation
├── src/
│   └── pdf_generator.py
├── images/          # Extracted images (generated at runtime)
└── input.7z         # Input archive
└── main.py          # Main application script

✅ Requirements

  • Python 3.13+
  • fpdf2 for PDF generation
  • Pillow for image resizing
  • py7zr for .7z extraction
  • loguru for logging
  • ruff for linting & formatting

📜 License

MIT License — feel free to use and adapt.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages