From f3f86c43a6831f1e15d497e6ed7377e7c18a6329 Mon Sep 17 00:00:00 2001 From: Jordan ERNST Date: Fri, 1 Mar 2019 14:52:13 +0100 Subject: [PATCH] Member edit implementation done. Recover previous picture added. --- IFPass.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)