This API service extracts specific data from PDF files based on provided templates and returns the data in JSON format.
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the application:
python app.pyEndpoint: POST /process-pdf
Request:
- Content-Type: multipart/form-data
- Body:
- file: PDF file
- template: JSON object defining the fields to extract
Example template:
{
"Description": {
"pattern": "Description"
},
"ISIN": {
"pattern": "ISIN"
},
"CUSIP": {
"pattern": "CUSIP"
},
"Price": {
"pattern": "Price"
}
}Response:
{
"Description": "Sample Description",
"ISIN": "US1234567890",
"CUSIP": "123456789",
"Price": "100.00"
}