/mailprep

Tool for converting vCard data into physical labels from SVG templates [MIRROR]

Primary LanguagePythonApache License 2.0Apache-2.0

mailprep

builds.sr.ht status


Table of Contents

Overview

mailprep converts vCard data into physical labels with a Dymo LabelWriter 4XL.

Example Output

Usage

$ mailprep --help
Usage: mailprep [OPTIONS] VCF_FILEPATH [TEMPLATE_FILEPATH]

Options:
  --printer TEXT   Printer Name
  --count INTEGER  number of labels to print
  --simulate       Generate output PDF without printing
  --help           Show this message and exit.

The default template is designed for 2.25" × 1.25" Uline S-12996 labels.

Installation

mailprep is distributed on PyPI as a universal wheel and is available on Linux/macOS and Windows and supports Python 3.5+ and PyPy.

$ pip install mailprep

Debian

The DYMO printer driver can be installed with

$ apt-get install printer-driver-dymo

Testing

System Dependencies

Debian/Stretch

Testing requires pdftotext and tox

$ apt-get install poppler-utils tox

Automatic Tests

Automatic tests can be run via any of the following methods depending on your workflow

$ python setup.py test
$ hatch test
$ tox

HitL Tests

Human/Hardware in the Loop tests can be run manually if xdg-open can find a pdf reader and a printer is connected.

$ hatch test --test-args "--hitl"
$ tox -- --hitl

Templates

Templates are stored as SVG and are evaluated using the Moustache template syntax. Currently the template processing is US-centric, but pull requests and test data is appreciated.

Formatted name

{{ fn }} in the template is replaced with the formatted name from the vCard.

Address

Currently mailprep generate labels from the vCard ADR Type Definition. In the future it may make more sense to use the LABEL Type Definition but it is unclear which produced more consistent results.

{{ adr_street }}
{{ adr_city }}, {{ adr_region }}
{{ adr_code }}

License

mailprep is distributed under the terms of both

at your option.

Test data

The vCard test data is from Wikipedia and is licensed as Creative Commons Attribution-ShareAlike.