|
|
@ -9,17 +9,7 @@ from reportlab.lib.units import mm |
|
|
|
from reportlab.lib.pagesizes import A4 |
|
|
|
from reportlab.lib.pagesizes import A4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parse_text_file(text_file, ignore_first_line=True): |
|
|
|
def fill(original_form, values, draw_function, output_file="filled.pdf"): |
|
|
|
with open(text_file) as fh: |
|
|
|
|
|
|
|
if ignore_first_line: |
|
|
|
|
|
|
|
next(fh) |
|
|
|
|
|
|
|
lines = [line.strip() for line in fh] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parts = [line.split("\t") for line in lines if line] |
|
|
|
|
|
|
|
return [tuple(map(str.strip, p)) for p in parts] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fill(original_form, draw_function, values, output_file="filled.pdf"): |
|
|
|
|
|
|
|
p = Path(output_file) |
|
|
|
p = Path(output_file) |
|
|
|
if p.exists(): |
|
|
|
if p.exists(): |
|
|
|
p.unlink() |
|
|
|
p.unlink() |
|
|
@ -60,42 +50,3 @@ def fill(original_form, draw_function, values, output_file="filled.pdf"): |
|
|
|
subprocess.run(["open", output_file]) |
|
|
|
subprocess.run(["open", output_file]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__=="__main__": |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attend = parse_text_file("teilnehmertabelle.txt") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_overlay(c, item): |
|
|
|
|
|
|
|
company, addr, name = item |
|
|
|
|
|
|
|
c.setFont("Helvetica", 11) |
|
|
|
|
|
|
|
c.drawString( 75*mm, 234*mm, "Universität Freiburg, IMTEK, CPI") |
|
|
|
|
|
|
|
c.drawString(118*mm, 225*mm, "20126 N") |
|
|
|
|
|
|
|
c.drawString( 58*mm, 216*mm, "VDK-Bestimmung in Jungbier") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if company.startswith("Wissenschaftsförderung"): |
|
|
|
|
|
|
|
c.setFont("Helvetica", 10) |
|
|
|
|
|
|
|
c.drawString( 35*mm, 204*mm, f"{company}, {addr}") |
|
|
|
|
|
|
|
if company.startswith("Wissenschaftsförderung"): |
|
|
|
|
|
|
|
c.setFont("Helvetica", 11) |
|
|
|
|
|
|
|
c.drawString( 35*mm, 191*mm, f"19.02.2019") |
|
|
|
|
|
|
|
c.drawString(113*mm, 191*mm, f"10:30 Uhr") |
|
|
|
|
|
|
|
c.drawString(150*mm, 191*mm, f"16:00 Uhr") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.drawString( 25.8*mm, 177.75*mm, f"X") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.drawString( 35*mm, 169*mm, name) |
|
|
|
|
|
|
|
c.drawString( 35*mm, 156*mm, "Teilname Kickoff-Meeting") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.drawString( 37.15*mm, 134.35*mm, f"X") |
|
|
|
|
|
|
|
c.drawString( 54*mm, 134*mm, "1") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.drawString( 24*mm, 82*mm, "Freiburg, den 19.02.2019") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.setFont("Helvetica-Bold", 12) |
|
|
|
|
|
|
|
c.drawString( 117*mm, 100*mm, "1.000") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#fill("form.pdf", create_overlay, attend) |
|
|
|
|
|
|
|
ruler_overlay("form.pdf") |
|
|
|
|
|
|
|