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

No packages published

Languages