j'avais oubli ceux-l
darcs-hash:20061025191655-f46e9-4ea2013ee62142cefd5f3f3f901c00fd72b50558.gz
This commit is contained in:
parent
4a2a8ce3bf
commit
c6cfa5b506
1 changed files with 3 additions and 7 deletions
|
@ -29,6 +29,7 @@
|
|||
import sys, time, tempfile, os, commands, string, random, re
|
||||
sys.path.append('/usr/scripts/gestion')
|
||||
import config
|
||||
from crans.utils import QuoteForPOSIX as escapeForShell
|
||||
def __init__():
|
||||
pass
|
||||
|
||||
|
@ -60,13 +61,11 @@ def base_prix_couleurs(path_fichier_pdf):
|
|||
# nom_rep seras le dossier dans tmp ou tous les fichier créé par
|
||||
# convert seront entreposé
|
||||
|
||||
path_fichier_pdf = re.sub(r"(?<=[^\\]) ", "\\ ", path_fichier_pdf)
|
||||
|
||||
nom_rep = tempfile.mkdtemp(prefix='tmpimpr')
|
||||
nom_png = "%s/convert.png" % nom_rep # Nom prefixe et chemin des png créé par convert
|
||||
|
||||
# Convertit les pdf en png couleur
|
||||
(status, rep) = commands.getstatusoutput("nice -n 5 gs -sDEVICE=png16m -r30 -dBATCH -dNOPAUSE -dSAFER -dPARANOIDSAFER -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dMaxBitmap=50000000 -sOutputFile=%s%%d -q %s" % (nom_png, path_fichier_pdf))
|
||||
(status, rep) = commands.getstatusoutput("nice -n 5 gs -sDEVICE=png16m -r30 -dBATCH -dNOPAUSE -dSAFER -dPARANOIDSAFER -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dMaxBitmap=50000000 -sOutputFile=%s%%d -q %s" % (nom_png, escapeForShell(path_fichier_pdf)))
|
||||
if status:
|
||||
raise FichierInvalide("ERREUR %s : Fichier invalide. Aucun png cree. (couleurs)" % status)
|
||||
|
||||
|
@ -107,14 +106,11 @@ def base_prix_nb(path_fichier_pdf):
|
|||
# nom_rep seras le dossier dans tmp ou tous les fichier créé par
|
||||
# convert seront entreposé
|
||||
|
||||
# on tranforme les espaces en "\ "
|
||||
path_fichier_pdf = re.sub(r"(?<=[^\\]) ", "\\ ", path_fichier_pdf)
|
||||
|
||||
nom_rep = tempfile.mkdtemp(prefix='tmpimpr')
|
||||
nom_png = "%s/convert.png" % nom_rep # Nom prefixe et chemin des png créé par convert
|
||||
|
||||
# Convertit les pdf en png
|
||||
(status, rep) = commands.getstatusoutput("nice -n 5 gs -sDEVICE=pnggray -r30 -dBATCH -dNOPAUSE -dSAFER -dPARANOIDSAFER -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dMaxBitmap=50000000 -sOutputFile=%s%%d -q %s" % (nom_png, path_fichier_pdf))
|
||||
(status, rep) = commands.getstatusoutput("nice -n 5 gs -sDEVICE=pnggray -r30 -dBATCH -dNOPAUSE -dSAFER -dPARANOIDSAFER -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -dMaxBitmap=50000000 -sOutputFile=%s%%d -q %s" % (nom_png, escapeForShell( path_fichier_pdf ) ))
|
||||
if status:
|
||||
raise FichierInvalide("ERREUR : Fichier invalide. Aucun png n'a ete cree.\n")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue