diff --git a/backend/README.md b/backend/README.md index 5d125d9..6e98457 100644 --- a/backend/README.md +++ b/backend/README.md @@ -8,6 +8,25 @@ Required : * python >= 3.4 with pip (Un VirtualEnv est conseillé !) +## pdfjinja + +exigences pour ubuntu : +``` +python-dev +python-pip +libtiff5-dev +libjpeg8-dev +zlib1g-dev +libfreetype6-dev +liblcms2-dev +libwebp-dev +tcl8.6-dev +tk8.6-dev +python-tk +pdftk +libmagickwand-dev +``` + ## Python Si vous utilisez un virtualenv : diff --git a/backend/app/tools/pdfjinja/insertTemplate.py b/backend/app/tools/insertTemplate.py similarity index 88% rename from backend/app/tools/pdfjinja/insertTemplate.py rename to backend/app/tools/insertTemplate.py index 7df834e..6e3f4c9 100644 --- a/backend/app/tools/pdfjinja/insertTemplate.py +++ b/backend/app/tools/insertTemplate.py @@ -5,7 +5,8 @@ import os from pdfjinja import PdfJinja -def remplirTemplate (dirname_template, pdf_template, dirname_output_file, pdf_output,dictionnaire): + +def remplir_template(dirname_template, pdf_template, dirname_output_file, pdf_output, dictionnaire): """ Fonction qui permet de remplir un pdf template :param dirname_template: chemin du fichier de template diff --git a/backend/app/tools/pdfjinja/README.md b/backend/app/tools/pdfjinja/README.md deleted file mode 100644 index d57ec54..0000000 --- a/backend/app/tools/pdfjinja/README.md +++ /dev/null @@ -1,25 +0,0 @@ -#pdfjinja 1.0.0 - -##Dependencies : - -python-dev -python-pip -libtiff5-dev -libjpeg8-dev -zlib1g-dev -libfreetype6-dev -liblcms2-dev -libwebp-dev -tcl8.6-dev -tk8.6-dev -python-tk -pdftk -libmagickwand-dev - -##Installation: - -pip install pdfjinja - -##Test : - -pdfjinja -h diff --git a/backend/requirements/common.txt b/backend/requirements/common.txt index 2a9108d..44c9e40 100644 --- a/backend/requirements/common.txt +++ b/backend/requirements/common.txt @@ -3,3 +3,4 @@ flask-script < 2.1 flask-sqlalchemy < 2.2 flask-restful < 0.4 mysqlclient < 1.4 +pdfjinja < 1.1 \ No newline at end of file diff --git a/backend/tests/tools/pdfjinja/testInsertTemplate.py b/backend/tests/tools/pdfjinja/testInsertTemplate.py index c613537..d9af502 100644 --- a/backend/tests/tools/pdfjinja/testInsertTemplate.py +++ b/backend/tests/tools/pdfjinja/testInsertTemplate.py @@ -1,12 +1,11 @@ -import json import os import unittest from io import BytesIO - from pathlib import Path + from pdfjinja import PdfJinja -from app.tools.pdfjinja.insertTemplate import remplirTemplate +from app.tools.insertTemplate import remplir_template class insertTemplateTestCase(unittest.TestCase): @@ -39,7 +38,7 @@ class insertTemplateTestCase(unittest.TestCase): del self.pdfjinja def test_render(self): - remplirTemplate(self.datadir,"sample.pdf",self.datadir,"output.pdf",self.data) + remplir_template(self.datadir, "sample.pdf", self.datadir, "output.pdf", self.data) output = self.pdfjinja(self.data) outfile = BytesIO() output.write(outfile)