TG-46 fusion pdf
This commit is contained in:
parent
58f9a6eebe
commit
c96d6ad0f8
10
backend/app/tools/FusionPdf.py
Normal file
10
backend/app/tools/FusionPdf.py
Normal file
@ -0,0 +1,10 @@
|
||||
import os
|
||||
from PyPDF2 import PdfFileReader, PdfFileMerger
|
||||
|
||||
|
||||
def fusion_fichiers(chemin_des_pdf, chemin_merge_pdf, nom_merge_pdf):
|
||||
pdf_files = [f for f in os.listdir(chemin_des_pdf) if f.endswith("pdf")]
|
||||
merger = PdfFileMerger()
|
||||
for filename in pdf_files:
|
||||
merger.append(PdfFileReader(os.path.join(chemin_des_pdf, filename), "rb"))
|
||||
merger.write(os.path.join(chemin_merge_pdf, nom_merge_pdf))
|
@ -1,12 +0,0 @@
|
||||
import os
|
||||
import PyPDF2
|
||||
from PyPDF2 import PdfFileReader, PdfFileMerger
|
||||
|
||||
files_dir = "C:\\olatest\\app\\pdf"
|
||||
pdf_files = [f for f in os.listdir(files_dir) if f.endswith("pdf")]
|
||||
merger = PdfFileMerger()
|
||||
|
||||
for filename in pdf_files:
|
||||
merger.append(PdfFileReader(os.path.join(files_dir, filename), "rb"))
|
||||
|
||||
merger.write(os.path.join(files_dir, "merged_full.pdf"))
|
0
backend/tests/tools/PyPDF2/TestFusionFichiers.py
Normal file
0
backend/tests/tools/PyPDF2/TestFusionFichiers.py
Normal file
0
backend/tests/tools/PyPDF2/__init__.py
Normal file
0
backend/tests/tools/PyPDF2/__init__.py
Normal file
@ -5,7 +5,7 @@ from pathlib import Path
|
||||
|
||||
from pdfjinja import PdfJinja
|
||||
|
||||
from app.tools.insertTemplate import remplir_template
|
||||
from app.tools.InsertTemplate import remplir_template
|
||||
|
||||
|
||||
class insertTemplateTestCase(unittest.TestCase):
|
Reference in New Issue
Block a user