|
|
|
|
@ -6,6 +6,7 @@ import tempfile |
|
|
|
|
from email.header import Header |
|
|
|
|
from time import time |
|
|
|
|
import simplejson as json |
|
|
|
|
import sys |
|
|
|
|
import subprocess as s |
|
|
|
|
from django.contrib import messages |
|
|
|
|
from django.db import DatabaseError |
|
|
|
|
@ -418,10 +419,12 @@ class BaseViews(object): |
|
|
|
|
"-sOutputFile=%s" % os.path.join(tmp_dir, "page-%03d.png"), |
|
|
|
|
"-f", filename |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
# ghostscript.Ghostscript(*args) # TODO: check on ubuntu |
|
|
|
|
try: |
|
|
|
|
p = s.Popen(args=args, stdout=s.PIPE, stderr=s.PIPE) |
|
|
|
|
# # ghostscript.Ghostscript(*args) # TODO: check on ubuntu |
|
|
|
|
p.wait() |
|
|
|
|
except OSError: |
|
|
|
|
sys.exit("Error executing Ghostscript. Is it in your PATH?") |
|
|
|
|
os.remove(filename) |
|
|
|
|
filename = '%s.pdf' % self.get_filename(*args, **kwargs) |
|
|
|
|
imgs = glob.glob(os.path.join(tmp_dir, '*.png')) |
|
|
|
|
|