|
@ -89,7 +89,7 @@ class TeXResponseMixin: |
|
|
nebo jiný seznam absolutních cest). |
|
|
nebo jiný seznam absolutních cest). |
|
|
""" |
|
|
""" |
|
|
dalsi_potrebne_soubory = [] |
|
|
dalsi_potrebne_soubory = [] |
|
|
tex = "pdflatex" |
|
|
tex_prikaz = "pdflatex" |
|
|
|
|
|
|
|
|
def render_to_response(self, context, **response_kwargs): |
|
|
def render_to_response(self, context, **response_kwargs): |
|
|
zdrojak = render_to_string(self.get_template_names(), context) |
|
|
zdrojak = render_to_string(self.get_template_names(), context) |
|
@ -100,7 +100,7 @@ class TeXResponseMixin: |
|
|
texfile.write(zdrojak) |
|
|
texfile.write(zdrojak) |
|
|
for file in self.dalsi_potrebne_soubory: |
|
|
for file in self.dalsi_potrebne_soubory: |
|
|
shutil.copy(file, tempdir) |
|
|
shutil.copy(file, tempdir) |
|
|
subprocess.call([self.tex, "main.tex"], cwd=tempdir, stdout=subprocess.DEVNULL) |
|
|
subprocess.call([self.tex_prikaz, "main.tex"], cwd=tempdir, stdout=subprocess.DEVNULL) |
|
|
|
|
|
|
|
|
with open(tempdir / "main.pdf", "rb") as pdffile: |
|
|
with open(tempdir / "main.pdf", "rb") as pdffile: |
|
|
response = HttpResponse(pdffile.read(), content_type='application/pdf', **response_kwargs) |
|
|
response = HttpResponse(pdffile.read(), content_type='application/pdf', **response_kwargs) |
|
|