Browse Source

Korekturovátko: Snad fix rozbitého ImageMagicku

middleware_test
LEdoian 6 years ago
parent
commit
0eadd8fcda
  1. 25
      korektury/models.py

25
korektury/models.py

@ -82,16 +82,25 @@ class KorekturovanePDF(models.Model):
self.stran = 0 self.stran = 0
while True: while True:
res = subprocess.call([ res = subprocess.call([
"convert", #Parametry inspirovány chybovou hláškou imagemagicku
"-density", "180x180", "gs",
"-geometry", " 1024x1448", "-sstdout=%stderr",
"%s[%d]" % (self.pdf.path, self.stran), "-dSAFER",
os.path.join( "-dNOPAUSE",
"-dBATCH",
"-dNOPROMPT",
"-sDEVICE=pngalpha",
"-r180x180",
"-dFirstPage=%d" % (self.stran+1),
"-dLastPage=%d" % (self.stran+1),
"-sOutputFile="+os.path.join(
dirname, dirname,
"%s-%d.png" % (self.get_prefix(), self.stran) "%s-%d.png" % (self.get_prefix(), self.stran)),
) "-f%s" % (self.pdf.path)
]) ])
if res == 1: if not os.path.exists(os.path.join(
dirname,
"%s-%d.png" % (self.get_prefix(), self.stran))):
break break
self.stran += 1 self.stran += 1
# Změnil se počet stran, ukládáme # Změnil se počet stran, ukládáme

Loading…
Cancel
Save