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
while True:
res = subprocess.call([
"convert",
"-density", "180x180",
"-geometry", " 1024x1448",
"%s[%d]" % (self.pdf.path, self.stran),
os.path.join(
#Parametry inspirovány chybovou hláškou imagemagicku
"gs",
"-sstdout=%stderr",
"-dSAFER",
"-dNOPAUSE",
"-dBATCH",
"-dNOPROMPT",
"-sDEVICE=pngalpha",
"-r180x180",
"-dFirstPage=%d" % (self.stran+1),
"-dLastPage=%d" % (self.stran+1),
"-sOutputFile="+os.path.join(
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
self.stran += 1
# Změnil se počet stran, ukládáme

Loading…
Cancel
Save