Ajout option --convert-only pour conversion sans impression
- Ajout flag --convert-only / --no-print - Permet conversion PDF sans impression automatique - Utile pour intégration bureau et workflows batch
This commit is contained in:
@@ -40,6 +40,7 @@ COLOR=false
|
||||
DUPLEX="none"
|
||||
INSTALL_DEPS=false
|
||||
KEEP_PDF=false
|
||||
CONVERT_ONLY=false
|
||||
CONFIG_FILE=""
|
||||
VERBOSE=false
|
||||
LOG_FILE=""
|
||||
@@ -99,6 +100,7 @@ OPTIONS:
|
||||
-d, --duplex MODE Mode recto-verso: none, simplex, duplex (défaut: none)
|
||||
-i, --install-deps Installer les dépendances automatiquement
|
||||
-k, --keep-pdf Conserver le fichier PDF après impression
|
||||
--convert-only, --no-print Conversion uniquement (sans impression)
|
||||
--config FILE Fichier de configuration
|
||||
-v, --verbose Mode verbeux (logging DEBUG)
|
||||
-l, --log FILE Fichier de log
|
||||
@@ -410,6 +412,11 @@ while [[ $# -gt 0 ]]; do
|
||||
KEEP_PDF=true
|
||||
shift
|
||||
;;
|
||||
--convert-only|--no-print)
|
||||
CONVERT_ONLY=true
|
||||
KEEP_PDF=true
|
||||
shift
|
||||
;;
|
||||
--config)
|
||||
if [ -z "${2:-}" ]; then
|
||||
log ERROR "Option --config nécessite un argument"
|
||||
@@ -629,27 +636,31 @@ case "$DUPLEX" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Impression
|
||||
log INFO "=== Impression ==="
|
||||
log INFO "Options:"
|
||||
log INFO " - Copies: $COPIES"
|
||||
log INFO " - Taille: $SIZE"
|
||||
log INFO " - Orientation: $ORIENTATION"
|
||||
log INFO " - Qualité: $QUALITY"
|
||||
log INFO " - Couleur: $([ "$COLOR" = true ] && echo "Oui" || echo "Non")"
|
||||
log INFO " - Recto-verso: $DUPLEX"
|
||||
[ -n "$PAGES" ] && log INFO " - Pages: $PAGES"
|
||||
[ -n "$PRINTER" ] && log INFO " - Imprimante: $PRINTER"
|
||||
# Impression (sauf si --convert-only)
|
||||
if [ "$CONVERT_ONLY" = false ]; then
|
||||
log INFO "=== Impression ==="
|
||||
log INFO "Options:"
|
||||
log INFO " - Copies: $COPIES"
|
||||
log INFO " - Taille: $SIZE"
|
||||
log INFO " - Orientation: $ORIENTATION"
|
||||
log INFO " - Qualité: $QUALITY"
|
||||
log INFO " - Couleur: $([ "$COLOR" = true ] && echo "Oui" || echo "Non")"
|
||||
log INFO " - Recto-verso: $DUPLEX"
|
||||
[ -n "$PAGES" ] && log INFO " - Pages: $PAGES"
|
||||
[ -n "$PRINTER" ] && log INFO " - Imprimante: $PRINTER"
|
||||
|
||||
log DEBUG "Exécution: lp ${LP_OPTS[*]} $PDF_FILE"
|
||||
log DEBUG "Exécution: lp ${LP_OPTS[*]} $PDF_FILE"
|
||||
|
||||
if ! lp "${LP_OPTS[@]}" "$PDF_FILE" 2>&1 | while IFS= read -r line; do log DEBUG "$line"; done; then
|
||||
if ! lp "${LP_OPTS[@]}" "$PDF_FILE" 2>&1 | while IFS= read -r line; do log DEBUG "$line"; done; then
|
||||
log ERROR "Erreur lors de l'impression"
|
||||
log INFO "Le fichier PDF a été conservé: $PDF_FILE"
|
||||
exit $EXIT_PRINT_ERROR
|
||||
fi
|
||||
fi
|
||||
|
||||
log INFO "Impression lancée avec succès!"
|
||||
log INFO "Impression lancée avec succès!"
|
||||
else
|
||||
log INFO "Mode conversion uniquement (pas d'impression)"
|
||||
fi
|
||||
|
||||
# Gestion du fichier PDF
|
||||
if [ "$KEEP_PDF" = false ]; then
|
||||
|
||||
Reference in New Issue
Block a user