diff --git a/IFPass.py b/IFPass.py index 1ae0f1c..4c3a437 100644 --- a/IFPass.py +++ b/IFPass.py @@ -15,6 +15,7 @@ from pywinauto.findwindows import find_window from pywinauto.win32functions import SetForegroundWindow from PIL import Image, ImageDraw, ImageFont from PyPDF2 import PdfFileReader, PdfFileWriter +import fitz import subprocess from shutil import copyfile, move from pyfiglet import Figlet @@ -437,7 +438,13 @@ def memberdo(choix, member): picture = getpic() else: # We crop pic from the previous card - pass + pdf = fitz.open('PDF.pdf') + page = pdf.loadPage(0) + mat = fitz.Matrix(4.165, 4.165) # To obtain good resolution + pix = page.getPixmap(matrix=mat) + + pageimg = Image.frombytes("RGBA", [pix.width, pix.height], pix.samples) + picture = pageimg.crop((47, 49, 343, 378)) barcode = barcode_gen(clientID) fillcard(clientID, titrename, firstname, dateexp, barcode, picture)