AGPL-3.0 Licensed PDF Processing Service
This is Service B of the Layered Pattern Converter project - a standalone FastAPI service that handles PDF layer processing using PyMuPDF. This service is licensed under AGPL-3.0 to comply with PyMuPDF's licensing requirements.
This service provides PDF processing capabilities for converting per-page layered PDFs into documents with global layers. It's designed to be called by Service A (the main application) via API.
- PDF analysis and layer detection
- Layer merging and PDF manipulation
- Preview and full document generation
- Temporary file management and cleanup
- API key authentication
- Python 3.8+
- PyMuPDF (AGPL licensed)
- FastAPI
- Uvicorn
- Clone this repository
- Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Copy
.env.exampleto.envand configure your API key
Start the service:
python -m uvicorn main:app --host 0.0.0.0 --port 3002 --reloadThe service will be available at http://localhost:3002
GET /health- Health checkPOST /process-pdf- Analyze PDF and detect layersPOST /merge-layers- Process PDF and merge layersGET /download/{filename}- Download processed files
PDF_WORKER_API_KEY- API key for authentication (required)
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
This licensing is required due to the use of PyMuPDF, which is AGPL-licensed. Any service that uses this code must also be made available under AGPL-3.0.
This service is part of a two-service architecture designed for license compliance:
- Service A (Private): Business logic, authentication, payments (proprietary license)
- Service B (Public): PDF processing with PyMuPDF (AGPL-3.0 license)
The services communicate via HTTP API with API key authentication, maintaining proper license isolation.