diff --git a/lib/impression/cout.py b/lib/impression/cout.py index 10e74671..85176336 100755 --- a/lib/impression/cout.py +++ b/lib/impression/cout.py @@ -87,7 +87,7 @@ def base_prix(path_pdf_file, color=False): nom_rep = tempfile.mkdtemp(prefix='tmpimpr') nom_png = "%s/convert.png" % nom_rep # Nom prefixe et chemin des png créé par convert escaped_path_pdf_file = escapeForShell(path_pdf_file) - escaped_path_ps_file = path_pdf_file + ".ps" + escaped_path_ps_file = escapeForShell(path_pdf_file + ".ps") error_msg = "ERREUR %%d : Fichier invalide. Aucun %s cree." if color: error_msg += " (couleurs)" @@ -99,12 +99,13 @@ def base_prix(path_pdf_file, color=False): nb_composante = 1 # Noir percent_program = "percentblack" - if os.stat(path_pdf_file)[stat.ST_MTIME] > os.stat(path_pdf_file + ".ps")[stat.ST_MTIME]: - # Convertit les pdf en ps - try_command("nice -n 5 pdftops %s %s" % (escaped_path_pdf_file, - escaped_path_ps_file), - nom_rep, - error_msg % "ps") + if not os.access(path_pdf_file + ".ps",os.F_OK) or \ + os.stat(path_pdf_file)[stat.ST_MTIME] > os.stat(path_pdf_file + ".ps")[stat.ST_MTIME]: + # Convertit les pdf en ps + try_command("nice -n 5 pdftops %s %s" % (escaped_path_pdf_file, + escaped_path_ps_file), + nom_rep, + error_msg % "ps") # Convertit les ps en png (il est néscessaire de passer par un ps # car ghostscript refuse certain pdf)