This web application allows you to upload PDF invoices and converts them to XRechnung XML format. The backend uses FastAPI for the API, integrates with Ollama's GPT-based models to extract invoice fields, and generates the XML output. The frontend is built with React for a dynamic user experience.
- Upload a PDF invoice.
- Extracts fields such as Invoice Number, Date, Total Amount, and Tax using Ollama's AI model.
- Returns a downloadable XRechnung XML file.
To use the Ollama model locally:
- Install Ollama by following the instructions on the Ollama website.
- Run the following command to start the Ollama service:
ollama start
- Frontend: React, CSS
- Backend: FastAPI, Python, PDFPlumber (for PDF text extraction), Ollama API (for field extraction)
- Docker: Containerized backend service
- Ollama: Custom-trained model to extract fields from invoices
uvicorn app.main:app --reload
cd frontend npm install npm start
- Clone the repository:
git clone https://github.com/vkresch/pdftoxrechnung.git cd pdftoxrechnung
docker-compose up -d --build
-
Make Sure Your Domain Points to the Server
Check with:
ping pdftoxrechnung.de
→ It should return your server’s public IP.
-
Start NGINX Temporarily in Challenge Mode
Let’s spin up NGINX with a config that only handles the HTTP challenge first. ✏️ nginx/nginx.conf (temporary certbot version):
server { listen 80; server_name pdftoxrechnung.de;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 404;
}
}
This serves only the .well-known path on port 80. It’s essential for Certbot to validate domain ownership.
- Start NGINX with Docker Compose
Make sure your folder structure looks like this:
. ├── docker-compose.yml ├── nginx/ │ └── nginx.conf ├── certbot/ │ └── www/
Then run:
docker-compose up -d nginx
This starts only the nginx container, which listens on port 80 and serves the challenge files.
- Run Certbot to Issue SSL
Now run the Certbot command:
docker run --rm -v "$(pwd)/nginx/ssl:/etc/letsencrypt" \
-v "$(pwd)/certbot/www:/var/www/certbot" \
certbot/certbot certonly \
--webroot --webroot-path=/var/www/certbot \
--email viktor.kreschenski@kretronik.com \
--agree-tos \
--no-eff-email \
-d pdftoxrechnung.de