mirror of https://gitlab.crans.org/bde/nk20
We need the french latex package
This commit is contained in:
parent
2d0ba4750c
commit
a220ca7549
|
@ -11,7 +11,7 @@ RUN apt update && \
|
||||||
|
|
||||||
# Install LaTeX requirements
|
# Install LaTeX requirements
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt install -y texlive-latex-extra texlive-fonts-extra && \
|
apt install -y texlive-latex-extra texlive-fonts-extra texlive-lang-french && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY . /code/
|
COPY . /code/
|
||||||
|
|
|
@ -15,7 +15,7 @@ On supposera pour la suite que vous utilisez Debian/Ubuntu sur un serveur tout n
|
||||||
|
|
||||||
La génération des factures de l'application trésorerie nécessite une installation de LaTeX suffisante :
|
La génération des factures de l'application trésorerie nécessite une installation de LaTeX suffisante :
|
||||||
|
|
||||||
$ sudo apt install texlive-latex-extra texlive-fonts-extra
|
$ sudo apt install texlive-latex-extra texlive-fonts-extra texlive-lang-french
|
||||||
|
|
||||||
2. Clonage du dépot
|
2. Clonage du dépot
|
||||||
|
|
||||||
|
|
|
@ -134,27 +134,17 @@ class BillingRenderView(LoginRequiredMixin, View):
|
||||||
f.write(tex.encode("UTF-8"))
|
f.write(tex.encode("UTF-8"))
|
||||||
del tex
|
del tex
|
||||||
|
|
||||||
error = subprocess.Popen(
|
for _ in range(2):
|
||||||
["pdflatex", "billing-{}.tex".format(pk)],
|
error = subprocess.Popen(
|
||||||
cwd=tmp_dir,
|
["pdflatex", "billing-{}.tex".format(pk)],
|
||||||
stdin=open(os.devnull, "r"),
|
cwd=tmp_dir,
|
||||||
stderr=open(os.devnull, "wb"),
|
stdin=open(os.devnull, "r"),
|
||||||
stdout=open(os.devnull, "wb")
|
stderr=open(os.devnull, "wb"),
|
||||||
).wait()
|
stdout=open(os.devnull, "wb")
|
||||||
|
).wait()
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
raise IOError("An error attempted while generating a billing:", error)
|
raise IOError("An error attempted while generating a billing (code=" + str(error) + ")")
|
||||||
|
|
||||||
error = subprocess.Popen(
|
|
||||||
["pdflatex", "billing-{}.tex".format(pk)],
|
|
||||||
cwd=tmp_dir,
|
|
||||||
stdin=open(os.devnull, "r"),
|
|
||||||
stderr=open(os.devnull, "wb"),
|
|
||||||
stdout=open(os.devnull, "wb")
|
|
||||||
).wait()
|
|
||||||
|
|
||||||
if error:
|
|
||||||
raise IOError("An error attempted while generating a billing:", error)
|
|
||||||
|
|
||||||
pdf = open("{}/billing-{}.pdf".format(tmp_dir, pk), 'rb').read()
|
pdf = open("{}/billing-{}.pdf".format(tmp_dir, pk), 'rb').read()
|
||||||
response = HttpResponse(pdf, content_type="application/pdf")
|
response = HttpResponse(pdf, content_type="application/pdf")
|
||||||
|
|
Loading…
Reference in New Issue