diff --git a/pdftools/cli.py b/pdftools/cli.py index c00c5d0..81fafd4 100644 --- a/pdftools/cli.py +++ b/pdftools/cli.py @@ -66,13 +66,13 @@ def nameplates(attendees, logo, size, adjust_x, adjust_y): size and adjustment options. """ if logo is not None: - logo = nameplate.Logo(logo, size * mm, adjust_x=adjust_x, adjust_y=adjust_y) + logo = nameplate.Logo( + logo, size * mm, adjust_x=adjust_x, adjust_y=adjust_y + ) npc = nameplate.NamePlateCards(logo) npc.generate(attendees, show=True) - - @click.command() @click.argument( "pdf", diff --git a/pdftools/formfill.py b/pdftools/formfill.py index 49ebf5e..0be893b 100644 --- a/pdftools/formfill.py +++ b/pdftools/formfill.py @@ -1,11 +1,9 @@ import pdfrw import subprocess -import itertools import tempfile from pathlib import Path from reportlab.pdfgen import canvas -from reportlab.lib.units import mm from reportlab.lib.pagesizes import A4 @@ -48,5 +46,3 @@ def fill(original_form, values, draw_function, output_file="filled.pdf"): # write the combined file to the output pdfrw.PdfWriter().write(output_file, form) subprocess.run(["open", output_file]) - - diff --git a/pdftools/nameplate.py b/pdftools/nameplate.py index 334f0b0..5a54b79 100644 --- a/pdftools/nameplate.py +++ b/pdftools/nameplate.py @@ -41,6 +41,7 @@ false_and_true = itertools.cycle([False, True]) imtek_logo_path = Path(__file__).parent / "logo_imtek.png" + class NamePlateCards: def __init__( self, diff --git a/pdftools/ruler.py b/pdftools/ruler.py index 3b9020d..53ab79e 100644 --- a/pdftools/ruler.py +++ b/pdftools/ruler.py @@ -5,20 +5,19 @@ from . import formfill def ruler_overlay(original_form): - def ruler(c, item): c.setStrokeColorRGB(0, 0, 1) c.setFillColorRGB(0, 0, 1) c.setLineWidth(0.5) c.setFont("Helvetica", 8) - x_grid = [x*mm for x in range(10, 210, 10)] - y_grid = [y*mm for y in range(10, 297, 10)] + x_grid = [x * mm for x in range(10, 210, 10)] + y_grid = [y * mm for y in range(10, 297, 10)] c.grid(x_grid, y_grid) for x in range(10, 210, 10): - c.drawString((x-2)*mm, 5*mm, str(x)) + c.drawString((x - 2) * mm, 5 * mm, str(x)) for y in range(10, 297, 10): - c.drawString(4*mm, (y-0.5)*mm, str(y)) + c.drawString(4 * mm, (y - 0.5) * mm, str(y)) ofp = Path(original_form) out_path = ofp.parent / f"{ofp.stem}_ruler.pdf"