PDF helpers for the work at IMTEK ================================= This package provides some cli commands: - `nameplates` generate a pdf with nameplates - `addruler` adds a blue ruler to a pdf And a module to assist with filling out pdf forms: `pdftools.formfill` nameplates (cli) ---------------- Usage: nameplates [OPTIONS] ATTENDEES [LOGO] creates a pdf with name plate cards The attendees file should be a tab separated text file with no headers. Put the company name in the first column, the given name in the second and the last name in the third column, e.g: Hochimin Enterprizes \t Jane \t Doe \n The positioning of the optional logo file can be controlled with the size and adjustment options. Options: -s, --size INTEGER [default: (10 mm)] -y, --adjust_y INTEGER [default: ( 0 mm)] -x, --adjust_x INTEGER [default: ( 0 mm)] --help Show this message and exit. addruler (cli) -------------- Usage: addruler [OPTIONS] PDF adds a blue ruler overlay to a pdf file Options: --help Show this message and exit. formfill (module) ----------------- The formfill module helps filling out pdf forms with other data. But there is no command line interface, you have to create a function on where to position what on the form. The function requires some Reportlab knowledge. An example: from pdftools.formfill import fill from reportlab.lib.units import mm # `parse_file` is an exercise to the reader attendees = parse_file("teilnehmertabelle.txt") # function defining where to draw what. def custom_function(canvas, item): # one item consists of three things company, address, name = item canvas.setFont("Helvetica", 11) canvas.drawString( 35*mm, 204*mm, f"{company}, {address}") canvas.setFont("Helvetica-Bold", 11) canvas.drawString( 35*mm, 169*mm, name) canvas.drawString( 35*mm, 82*mm, "19.02.2019") # "form.pdf" should be the path to the form file fill("form.pdf", attendees, custom_function)