[lib/impression_canon, intranet/impression] gestion de pdfbook
Ignore-this: 11acbb5ac4700d722236fd5f169933b2 darcs-hash:20090516015444-bd074-71fb4a65b486706af7d6b6a780ec4782b0935f53.gz
This commit is contained in:
parent
0c499d75b6
commit
da152761b4
2 changed files with 14 additions and 6 deletions
|
@ -25,6 +25,9 @@
|
|||
# #############################################################
|
||||
|
||||
import cherrypy, tempfile, shutil, os, commands, re
|
||||
from re import compile
|
||||
BOOK_REGEXP = compile('book.pdf')
|
||||
|
||||
from crans.impression.impression_canon import FichierInvalide,SoldeInsuffisant,impression
|
||||
import crans.impression.digicode
|
||||
import crans.impression.etat_imprimante
|
||||
|
@ -32,6 +35,7 @@ import crans.cp
|
|||
from threading import Thread
|
||||
FILE_UPLOAD_BASE_FOLDER = cherrypy.config.get('fileUpload.folder', "/var/impression/fichiers/")
|
||||
|
||||
|
||||
class FileError(Exception):
|
||||
pass
|
||||
from ClassesIntranet.ModuleBase import ModuleBase
|
||||
|
@ -244,6 +248,7 @@ class main(ModuleBase):
|
|||
# exclusion des fichiers qui ne sont pas des PDF
|
||||
for f in liste:
|
||||
if commands.getoutput('file -ib %s' % commands.mk2arg(file_folder, f)) == "application/pdf":
|
||||
if not BOOK_REGEXP.search(f):
|
||||
list_pdf.append(f)
|
||||
return list_pdf
|
||||
|
||||
|
|
|
@ -174,12 +174,15 @@ class impression:
|
|||
|
||||
|
||||
def _pdfbook(self):
|
||||
if self.taille == 'A3':
|
||||
pdfbook = "pdfbook --paper a3paper %s"
|
||||
if self._settings['papier'] == 'A3':
|
||||
newfile = self._fichier[:-4] + '-a3book.pdf'
|
||||
pdfbook = "pdfbook --paper a3paper %%s --outfile %s" % newfile
|
||||
else:
|
||||
pdfbook = "pdfbook %s"
|
||||
(status, rep) = commands.getstatusoutput(pdfbook % self._fichier)
|
||||
self._fichier = "%s-book.pdf" % self.n_fichier[:-4]
|
||||
newfile = self._fichier[:-4] + '-book.pdf'
|
||||
pdfbook = "pdfbook %%s --outfile %s" % newfile
|
||||
(status, rep) = getstatusoutput(pdfbook % self._fichier)
|
||||
LOG.info("%s | rep: %s" % ((pdfbook % self._fichier), rep))
|
||||
self._fichier = newfile
|
||||
if status != 0:
|
||||
LOG.error("pdfbook status:%d | rep: %s" % (status, rep))
|
||||
raise FichierInvalide, ("pdfbook: Impossible de convertir le fichier",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue