Skip to content

Repository files navigation

PDF Tools

A modern web application for PDF manipulation built with Python Flask backend and Next.js frontend.

Features

  • Split PDF: Split PDF files into individual pages or extract specific page ranges
  • Merge PDF: Combine multiple PDF files into a single document
  • PDF to Word: Convert PDF documents to editable Word files (.docx)
  • Word to PDF: Convert Word documents to PDF format

Tech Stack

Backend

  • Python 3.11
  • Flask
  • PyPDF2 (PDF manipulation)
  • pdf2docx (PDF to Word conversion)
  • LibreOffice (Word to PDF conversion)

Frontend

  • Next.js 14
  • React 18
  • TypeScript
  • Tailwind CSS
  • Axios

Getting Started

Prerequisites

  • Docker and Docker Compose
  • (Optional) Node.js 18+ and Python 3.11+ for local development

Running with Docker (Recommended)

  1. Clone the repository:
git clone <repository-url>
cd pdf
  1. Build and run the containers:
docker-compose up --build
  1. Access the application:

Local Development

Backend

  1. Navigate to the backend directory:
cd backend
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Install LibreOffice (required for Word to PDF conversion):

    • Ubuntu/Debian: sudo apt-get install libreoffice
    • macOS: brew install --cask libreoffice
    • Windows: Download from https://www.libreoffice.org/
  2. Run the Flask server:

python app.py

The backend will run on http://localhost:5000

Frontend

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Create a .env.local file:
NEXT_PUBLIC_API_URL=http://localhost:5000
  1. Run the development server:
npm run dev

The frontend will run on http://localhost:3000

API Endpoints

Health Check

GET /health

Split PDF

POST /split-pdf
Content-Type: multipart/form-data

Parameters:
- file: PDF file
- mode: 'all' or 'range'
- start_page: (optional, for range mode) starting page number
- end_page: (optional, for range mode) ending page number

Merge PDF

POST /merge-pdf
Content-Type: multipart/form-data

Parameters:
- files: Multiple PDF files (minimum 2)

PDF to Word

POST /pdf-to-word
Content-Type: multipart/form-data

Parameters:
- file: PDF file

Word to PDF

POST /word-to-pdf
Content-Type: multipart/form-data

Parameters:
- file: Word document (.docx or .doc)

Docker Commands

Build and run containers

docker-compose up --build

Run in background

docker-compose up -d

Stop containers

docker-compose down

View logs

docker-compose logs -f

Rebuild a specific service

docker-compose up --build backend
docker-compose up --build frontend

Features

Responsive Design

The application is fully responsive and works on:

  • Desktop computers
  • Tablets
  • Mobile phones

User-Friendly Interface

  • Drag and drop file upload
  • Clear visual feedback
  • Progress indicators
  • Error handling
  • Clean and modern UI

Secure

  • Files are automatically deleted after processing
  • No data is stored permanently
  • All processing happens server-side

File Size Limits

  • Maximum file size: 50MB per file
  • Maximum files for merge: 10 PDFs

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages