2023-02-07 13:03:54 +11:00
2023-02-07 12:54:05 +11:00
2023-02-07 13:03:54 +11:00
2021-04-26 14:54:03 +10:00
2021-04-26 14:54:03 +10:00
2023-02-07 13:03:54 +11:00
2021-04-26 14:54:03 +10:00
2021-04-26 14:54:03 +10:00

PyLabel

Generate labels for printing using HTML rendering.

Features

  • Customizable for most label sheet layouts.
  • Partial sheet printing
  • Custom data for each label
  • Uses HTML templates easy label design.

Usage

The simplest use case is some static labels using a template:

python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 > output.html

Then, when you need some more just pop the same sheet back in the printer and offset the start

python -m pylabel -t examples/simple.html -p avery.L7157 -c 10 -o 10 > output.html

To do some mail merge operations create a list of names:

Andy Andrews
Bob Brown
Charlie Chaplin

and use a {data[text]} element in your template. Note we've shifted to an external stylesheet now as well.

python -m pylabel -t examples/name_tags.html -p avery.L7157 -d examples/names.txt -s examples/hello.css > output.html

Full list of options python -m pylabel -h

usage: __main__.py [-h] [--count COUNT] [--offset OFFSET] [--profile PROFILE] [--template TEMPLATE] [--style STYLE] [--data DATA] [--json] [--logging LOGGING] [spec]

Generate a page of labels

positional arguments:
spec                  Specification module

options:
-h, --help            show this help message and exit
--count COUNT, -c COUNT
                        Number of labels to generate
--offset OFFSET, -o OFFSET
                        Skip first n labels
--profile PROFILE, -p PROFILE
                        Label profile
--template TEMPLATE, -t TEMPLATE
                        Template for label
--style STYLE, -s STYLE
                        Additional stylesheet
--data DATA, -d DATA  Pre-generated data, one entry per line
--json, -j            Parse data lines as json
--logging LOGGING, -l LOGGING
                        Logging level
Description
Generate label sheets using HTML templates
Readme 31 KiB
Languages
Python 88.9%
CSS 9%
HTML 2.1%