This service provides a REST API for compressing PDF files and optionally converting them to DOCX format using Ghostscript and pdf2docx.
- Compress PDF files using Ghostscript.
- Merge multiple PDF files and compress them.
- Convert compressed PDF files to DOCX format.
- Upload processed files to Google Cloud Storage.
- Generate signed URLs for downloading processed files.
- GET
/health
- Returns a JSON object indicating the health status of the service.
- POST
/compressPdf
- Compresses PDF files and optionally converts them to DOCX format.
- Request Body:
{ "template": "<template_name>", "pdfFilePaths": ["<path_to_pdf1>", "<path_to_pdf2>"], "reportName": "<report_name>", "isDocx": true/false, "numPages": 0 }
- Response:
{ "url": "<signed_url>" }
To run this service, you will need to install the following dependencies:
- Python 3.8 or higher
- Flask
- Ghostscript (AGPL-licensed)
- pdf2docx 0.5.8
- PyPDF2
- Google Cloud SDK (for Google Cloud Storage integration)
Install dependencies using the following command:
pip install -r requirements.txt