Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDFKit

A fast, local-first Streamlit app for PDF tasks — convert, compress, and generate PDFs. No cloud, no uploads, no hassle.

Features

Tool Description
Image to PDF Upload multiple images and combine them into a single PDF document with customizable margins and page ordering
Word to PDF Convert Word documents (.docx) to PDF format
PDF to Word Convert PDF documents to editable Word files (.docx)
PDF Compress Reduce PDF file size by re-encoding images at lower quality and resolution

Tech Stack

  • Python 3.11+
  • Streamlit — Web UI framework
  • Pillow — Image processing
  • ReportLab — PDF generation (Image to PDF)
  • docx2pdf — Word to PDF conversion
  • pdf2docx — PDF to Word conversion
  • pikepdf — PDF compression (image re-encoding)

Project Structure

pdfkit/
├── app.py                      # Streamlit entry point (tabbed UI)
├── requirements.txt            # Python dependencies
├── src/
│   ├── __init__.py
│   ├── pdf_generator.py        # Image → PDF
│   ├── word_to_pdf.py          # Word → PDF
│   ├── pdf_to_word.py          # PDF → Word
│   └── pdf_compress.py         # PDF compression
├── .streamlit/
│   └── config.toml             # Streamlit configuration
├── tests/
├── assets/
└── output/                     # Generated files (not tracked)

Installation

Prerequisites

  • Python 3.11 or higher
  • pip package manager

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/pdfkit.git
    cd pdfkit
  2. Create a virtual environment:

    python -m venv venv
    # Windows
    venv\Scripts\activate
    # macOS/Linux
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt

Note: Word to PDF conversion requires Microsoft Word installed on your system (Windows/macOS).

Usage

Run the Streamlit application:

streamlit run app.py

The application will open in your browser at http://localhost:8501.

Image to PDF

  1. Upload one or more images (PNG, JPG, JPEG, BMP, TIFF, WebP)
  2. Optionally set a PDF title and page margins in the sidebar
  3. Reorder images using comma-separated indices if needed
  4. Click Generate PDF and download the result

Word to PDF

  1. Upload a .docx file
  2. Click Convert to PDF
  3. Download the generated PDF

PDF to Word

  1. Upload a PDF file
  2. Click Convert to Word
  3. Download the generated .docx file

PDF Compress

  1. Upload a PDF file
  2. Set a target file size (KB)
  3. Click Compress PDF
  4. Download the compressed file

Security

  • All file processing happens locally — no data is sent to external servers
  • No API keys, tokens, or credentials are required
  • Generated files are stored temporarily in the output/ directory and are not tracked

Development

Running Tests

python -m pytest tests/

Adding New Features

  1. Create a new module in src/ with the core logic
  2. Add a new tab in app.py
  3. Import and wire up the module in the new tab
  4. Keep UI and logic separate

License

This project is open source and available under the MIT License.

About

PDFKit is a fast, privacy-focused web app for everyday PDF operations. Convert images and Word docs to PDF, compress large files, and generate PDFs from images — all running locally on your machine with zero data transmission.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages