TG-46 ajout fusion_pdf.py
Fichier de fusion des documents pdf
This commit is contained in:
parent
b3ae8006ef
commit
59d64b32ba
12
backend/app/fusion_pdf.py
Normal file
12
backend/app/fusion_pdf.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
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"))
|
Reference in New Issue
Block a user