- Python 86.8%
- Jupyter Notebook 9.3%
- Dockerfile 3.9%
fix(deps): update dependency kimiworker to v8.0.4 See merge request logius/nldoc/worker/pdf-metadata!104 |
||
|---|---|---|
| .vscode | ||
| integration_test | ||
| .coveragerc | ||
| .editorconfig | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| CHANGELOG.md | ||
| CODEOWNERS | ||
| conftest.py | ||
| CONTRIBUTING.md | ||
| docker-compose.yaml | ||
| Dockerfile | ||
| integration.ipynb | ||
| LICENSE | ||
| main.py | ||
| poetry.lock | ||
| pyproject.toml | ||
| README.md | ||
| renovate.json | ||
| test.ipynb | ||
| test_main.py | ||
| test_worker.py | ||
PDF Metadata
This Python worker extracts metadata from PDF files, gathering information such as basic document details (author, creator, title, subject), technical specifications (PDF version, page count, page size), security features (encryption status, JavaScript presence), and relevant dates (creation and modification dates)
Features
- Metadata extraction using pdf2image's pdfinfo_from_path
- Integration with RabbitMQ for message queuing
- MinIO support for object storage
- Docker and Kubernetes deployment ready
Getting Started
Local Installation
-
Clone the repository:
git clone https://gitlab.com/logius/nldoc/worker/pdf-metadata.git cd pdf-metadata -
Install Poetry (dependency management):
curl -sSL https://install.python-poetry.org | python3 - -
Install dependencies:
poetry install -
Install shell plugin:
poetry self add poetry-plugin-shell -
Activate virtual environment:
poetry shell
Running the Worker
Using Docker Compose (Recommended)
-
Ensure Docker and Docker Compose are installed (Installation Guide)
-
Start the services:
docker compose up -
Use the included Jupyter notebook
integration.ipynbto perform an end to end interaction using Minio and RabbitMQ -
Access the management interfaces:
- RabbitMQ Console:
http://localhost:15672/ - MinIO Console:
http://localhost:9001/
- RabbitMQ Console:
-
Once the
docker compose upcommand has been exited using Ctrl+C, all containers relative to this instance will have shut down automatically.
Running Directly
To run the worker without Docker:
python3 main.py
For configuration options, refer to the Python base worker config.
Testing and Development
Use the included Jupyter notebook test.ipynb to run the metadata extraction on a sample document:
- Ensure all dependencies are installed (follow installation steps above)
- Launch Jupyter notebook
- Open
test.ipynband run the cells to process sample pages
Deployment
Docker Images
Pre-built Docker images are available in our container registry.
Run the latest version:
docker run --rm registry.gitlab.com/logius/nldoc/worker/pdf-metadata:latest
Documentation
License
This project is licensed under the European Union Public License 1.2 - see LICENSE for details.
Acknowledgements
- Edouard Belval for his pdf2image module