240 lines
4.3 KiB
Markdown
240 lines
4.3 KiB
Markdown
# 🚀 Guide de démarrage rapide - pdf2csv v2.0
|
|
|
|
## ⚡ Démarrage ultra-rapide (Docker)
|
|
|
|
```bash
|
|
# 1. Construire l'image
|
|
docker build -t pdf2csv .
|
|
|
|
# 2. Créer un dossier avec vos PDFs
|
|
mkdir data
|
|
cp vos_pdfs/*.pdf data/
|
|
|
|
# 3. Lancer la conversion
|
|
docker run --rm -v $(pwd)/data:/data pdf2csv
|
|
|
|
# 4. Récupérer le résultat
|
|
cat data/fusion_total.csv
|
|
```
|
|
|
|
---
|
|
|
|
## 📦 Utilisation avec Make (Recommandé)
|
|
|
|
```bash
|
|
# Construire
|
|
make build
|
|
|
|
# Placer vos PDFs dans ./data/
|
|
mkdir -p data
|
|
cp vos_pdfs/*.pdf data/
|
|
|
|
# Lancer
|
|
make run
|
|
|
|
# Ou en mode verbeux
|
|
make run-verbose
|
|
|
|
# Voir toutes les commandes
|
|
make help
|
|
```
|
|
|
|
---
|
|
|
|
## 🐍 Utilisation locale (sans Docker)
|
|
|
|
```bash
|
|
# 1. Installer les dépendances
|
|
pip install -r requirements.txt
|
|
|
|
# 2. S'assurer que Java est installé
|
|
java -version # Si erreur, installer: sudo apt-get install openjdk-17-jre
|
|
|
|
# 3. Lancer
|
|
python convert.py ./data --verbose
|
|
```
|
|
|
|
---
|
|
|
|
## ⚙️ Configuration personnalisée
|
|
|
|
```bash
|
|
# 1. Créer un fichier de configuration
|
|
cp config.example.env .env
|
|
|
|
# 2. Éditer .env
|
|
nano .env
|
|
|
|
# 3. Lancer avec la configuration
|
|
docker run --rm -v $(pwd)/data:/data --env-file .env pdf2csv --verbose
|
|
```
|
|
|
|
**Ou avec Make:**
|
|
```bash
|
|
make run-custom
|
|
```
|
|
|
|
---
|
|
|
|
## 📊 Options disponibles
|
|
|
|
```bash
|
|
# Mode verbeux (logs détaillés)
|
|
python convert.py ./data --verbose
|
|
|
|
# Personnaliser les mots-clés
|
|
python convert.py ./data --mot-debut "BALANCE" --mot-fin "TOTAL"
|
|
|
|
# Conserver les fichiers temporaires (debug)
|
|
python convert.py ./data --no-clean
|
|
|
|
# Aide complète
|
|
python convert.py --help
|
|
```
|
|
|
|
---
|
|
|
|
## 🔧 Variables d'environnement
|
|
|
|
| Variable | Valeur par défaut | Description |
|
|
|----------|-------------------|-------------|
|
|
| `MOT_DEBUT` | `SOLDE` | Début des données |
|
|
| `MOT_FIN` | `Total des mouvements` | Fin des données |
|
|
| `MOT_DATE` | `date` | En-tête à ignorer |
|
|
| `SKIP_LINES` | `3` | Lignes à sauter |
|
|
|
|
---
|
|
|
|
## ✅ Test de l'installation
|
|
|
|
```bash
|
|
# Script de test automatique
|
|
./test_script.sh
|
|
|
|
# Test manuel
|
|
python convert.py --help
|
|
```
|
|
|
|
---
|
|
|
|
## 📁 Structure des fichiers résultants
|
|
|
|
```
|
|
data/
|
|
├── releve1.pdf ← Votre PDF d'origine
|
|
├── releve1_brut.csv ← CSV brut (supprimé par défaut)
|
|
├── releve1_final.csv ← CSV nettoyé
|
|
├── releve2.pdf
|
|
├── releve2_final.csv
|
|
└── fusion_total.csv ← 🎯 FICHIER FINAL FUSIONNÉ
|
|
```
|
|
|
|
---
|
|
|
|
## 🆘 Problèmes courants
|
|
|
|
### "Aucun PDF trouvé"
|
|
```bash
|
|
# Vérifier que les PDFs sont bien dans le bon dossier
|
|
ls -la data/*.pdf
|
|
|
|
# Vérifier le montage Docker
|
|
docker run --rm -v $(pwd)/data:/data pdf2csv ls -la /data
|
|
```
|
|
|
|
### "Java not found"
|
|
```bash
|
|
# Installer Java
|
|
sudo apt-get update
|
|
sudo apt-get install openjdk-17-jre-headless
|
|
```
|
|
|
|
### "Module tabula not found"
|
|
```bash
|
|
# Installer les dépendances
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### Résultats incorrects
|
|
```bash
|
|
# Lancer en mode verbeux pour voir les étapes
|
|
python convert.py ./data --verbose
|
|
|
|
# Ajuster la configuration
|
|
python convert.py ./data --mot-debut "VOTRE_MOT" --verbose
|
|
```
|
|
|
|
---
|
|
|
|
## 📚 Documentation complète
|
|
|
|
- **README.md** : Documentation complète
|
|
- **CHANGELOG.md** : Liste des améliorations
|
|
- **Makefile** : Commandes disponibles (`make help`)
|
|
- **config.example.env** : Exemple de configuration
|
|
|
|
---
|
|
|
|
## 💡 Exemples d'utilisation
|
|
|
|
### Exemple 1 : Relevés bancaires
|
|
```bash
|
|
docker run --rm -v $(pwd)/relevés:/data pdf2csv
|
|
```
|
|
|
|
### Exemple 2 : Factures personnalisées
|
|
```bash
|
|
docker run --rm \
|
|
-v $(pwd)/factures:/data \
|
|
-e MOT_DEBUT="FACTURE N°" \
|
|
-e MOT_FIN="TOTAL TTC" \
|
|
pdf2csv --verbose
|
|
```
|
|
|
|
### Exemple 3 : Traitement par lots
|
|
```bash
|
|
# Traiter tous les PDFs d'un dossier
|
|
for dir in client_*; do
|
|
echo "Traitement de $dir..."
|
|
docker run --rm -v $(pwd)/$dir:/data pdf2csv
|
|
done
|
|
```
|
|
|
|
---
|
|
|
|
## 🎯 Commandes essentielles
|
|
|
|
```bash
|
|
# Construction
|
|
docker build -t pdf2csv . # Ou: make build
|
|
|
|
# Utilisation basique
|
|
docker run --rm -v $(pwd)/data:/data pdf2csv
|
|
|
|
# Mode debug
|
|
docker run --rm -v $(pwd)/data:/data pdf2csv --verbose
|
|
|
|
# Avec configuration
|
|
docker run --rm -v $(pwd)/data:/data --env-file .env pdf2csv
|
|
|
|
# Shell interactif (debug)
|
|
docker run --rm -it -v $(pwd)/data:/data --entrypoint /bin/bash pdf2csv
|
|
|
|
# Statut
|
|
make status
|
|
```
|
|
|
|
---
|
|
|
|
## 📞 Aide
|
|
|
|
Pour plus d'informations :
|
|
```bash
|
|
python convert.py --help
|
|
make help
|
|
cat README.md
|
|
```
|
|
|
|
Bon traitement ! 🚀
|
|
|