# PDF Processing Server FastAPI server for online PDF processing. ## Table of Contents - [Introduction](#introduction) - [Installation](#installation) - [Configuration](#configuration) - [Running the Server](#running-the-server) - [API Endpoints](#api-endpoints) - [Extraction Endpoint](#extraction-endpoint) - [Replacement Endpoint](#replacement-endpoint) - [License](#license) ## Introduction PDF Processing Server is a FastAPI-based server designed for online PDF processing. It provides endpoints for extracting text from PDF files and replacing content within PDF files. This project is developed and maintained by Gleematic Pte. Ltd. ## Installation 1. Clone the repository: ```sh git clone cd PDF-Processing-Server ``` 2. Create a virtual environment and activate it: ```sh python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` ``` 3. Install the dependencies: ```sh pip install -r requirements.txt ``` ## Configuration 1. Copy the [.env.example](.env.example) file to [.env](.env): ```sh cp .env.example .env ``` 2. Edit the [.env](.env) file to set your configuration values: ```env BASE_DIR=/path/to/base/dir API_KEY=your_api_key ``` ## Running the Server 1. Start the FastAPI server: ```sh uvicorn app.main:app --reload ``` 2. The server will be running at `http://127.0.0.1:8000`. ## API Endpoints ### Extraction Endpoint - **URL:** `/extraction` - **Method:** `POST` - **Request Body:** ```json { "pdf_zip": "base64_encoded_zip_file" } ``` - **Response:** ```json { "status": "success", "data": "base64_encoded_extracted_texts" } ``` ### Replacement Endpoint - **URL:** `/replacement` - **Method:** `POST` - **Request Body:** ```json { "pdf_zip": "base64_encoded_zip_file", "replacement_data": "base64_encoded_json_string", "preserve_original_fonts": true } ``` - **Response:** ```json { "status": "success", "data": "base64_encoded_output_zip" } ``` ## License This project is licensed under the AGPL License due to its dependency on [PyMuPDF](https://github.com/pymupdf/PyMuPDF), which is licensed under AGPL. For more details, see the [AGPL-3.0 License](https://www.gnu.org/licenses/agpl-3.0.html). --- Developed and maintained by [Gleematic Pte. Ltd.](https://www.gleematic.com)