Skip to content

A self hostable Flask web application that splits a PDF file into individual pages

License

Notifications You must be signed in to change notification settings

tshenolo/flask-pdf-splitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✂️ Flask PDF Splitter

A self hostable Flask web application that splits a PDF file into individual pages and provides download links for each split page.

Screenshot

Features

  • Upload a PDF file and split it into individual pages.
  • Download each page as a separate PDF.

Requirements

  • Python 3.10 or higher
  • Flask
  • PyPDF2

Getting Started

  1. Clone the Repository
git clone https://github.com/tshenolo/flask-pdf-splitter.git
cd flask-pdf-splitter
  1. Installation Install dependencies You can install the required dependencies by running:
pip install -r requirements.txt

Running the Application

On Windows

  1. Open Command Prompt or PowerShell and navigate to the project directory.

  2. Set the FLASK_APP environment variable:

set FLASK_APP=app.py
  1. Start the Flask server:
python app.py
  1. Open a browser and go to http://127.0.0.1:5000

On Linux

  1. Open a terminal and navigate to the project directory.

  2. Set the FLASK_APP environment variable:

export FLASK_APP=app.py
  1. Start the Flask server:
python app.py
  1. Open a browser and go to http://127.0.0.1:5000

Running the Application with Docker

  1. Build the Docker Image:
docker build -t flask-pdf-splitter .
  1. Run the Docker Container:
docker run -p 5000:5000 -v $(pwd)/static/pages:/app/static/pages flask-pdf-splitter
  1. Access the Application: Open your browser and navigate to http://localhost:5000.

Usage

  1. Upload a PDF file using the file upload form.
  2. Click the "Split PDF" button.
  3. The split pages will be displayed as download links for each page.

Directory Structure

flask-pdf-splitter/
├── app.py              # Main application file
├── Dockerfile          # Docker configuration
├── requirements.txt    # Python dependencies
├── templates/
│   └── index.html      # HTML template for the application
└── static/
    └── pages/          # Directory where split pages are saved

Contributing

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Create a new Pull Request.

License

This project is licensed under the MIT License.

About

A self hostable Flask web application that splits a PDF file into individual pages

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published