Skip to main content

pylabels is a Python library for creating PDFs to print sheets of labels. It uses the ReportLab PDF toolkit to produce the PDF.

Basically, the user creates a set of specifications of the label sizes etc, writes a callback function which does the actual drawing, and gives these two items to a Sheet object. Items are then added to the sheet using the add_label() method (or add_labels() to add all items from an iterable).

The callback function is called once for each item, being given a ReportLab Drawing object representing the label, its width and height, and the item to draw on the label. Any of the standard ReportLab drawing methods can be used, with pylabels automatically adding a clipping path around each label to prevent it interfering with other labels.

Once all the items have been added, the labels can be saved as a PDF, or a preview of a page can be saved as an image.

Website

pylabels is hosted on GitHub at https://github.com/bcbnz/pylabels/

Examples

The following examples are available in the demos directory on GitHub:

  • Basic - a introduction to the basic use of pylabels.

  • Partial pages - how to produce partial pages (i.e., pages with some of the labels previously used).

  • Background colours - examples of solid, striped and hatched backgrounds of different colours on each label.

  • Page background - how to add a background image for each page.

  • Padding - how to add padding to the labels.

  • Nametags - creates a set of nametags from the list of names in the names.txt file. Includes the use of two custom fonts, font size selection, and centred text.

  • Image preview - generates image previews of two of the pages from the nametags demo.

Demo fonts

The following fonts are used in the demo scripts and are included in the demos folder:

License

Copyright (C) 2012, 2013, 2014, 2015 Blair Bonnett

pylabels is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

pylabels is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with pylabels. If not, see http://www.gnu.org/licenses/.

Metadata

Release files for pylabels 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylabels 1.2.1
File Size Uploaded
pylabels-1.2.1.tar.gz 13.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pylabels 1.2.1
File Interpreter ABI Platform
pylabels-1.2.1-py3.5.egg Legacy Egg format - - Details
pylabels-1.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details
pylabels-1.2.1-py2.7.egg Legacy Egg format - - Details

Total release size: 80.5 kB

Release files / pylabels-1.2.1.tar.gz

Download URL pylabels-1.2.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
299b4f97b6266427cc5acdb99b4699a8b6f381242f2d73513b892fa8857a073f
BLAKE2b-256 checksum
How to use checksums
754e0ee2f00b3a6465b1a9eba3e08fa43e066ba0e659e91c7cda07b9c47ef4b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pylabels-1.2.1-py3.5.egg

Download URL pylabels-1.2.1-py3.5.egg
Size 25.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
422fd5e839c92a3363d4fcd2b90308642aea1382e47e57fc4cfd4f737d4a7111
BLAKE2b-256 checksum
How to use checksums
919cdd2357398de0e3d5e1ae534fe95ffb0fcc25ba69cd918460fd1d80025dea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pylabels-1.2.1-py2.py3-none-any.whl

Download URL pylabels-1.2.1-py2.py3-none-any.whl
Size 16.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
32cad77ff07bac765a2ba9379c81b26fd679693aa4b24a640e5e53b2f3fec7af
BLAKE2b-256 checksum
How to use checksums
64480e6f01193075ad8d4751cb2bebcd8fadaa42a52ec1de6ce17c4933f88f42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pylabels-1.2.1-py2.7.egg

Download URL pylabels-1.2.1-py2.7.egg
Size 25.4 kB
Tags Egg
SHA-256 checksum
How to use checksums
e3ed2b094694b2e9ae7ae429944ef5f546eefb8773c94857d8a9bc3a00906ca4
BLAKE2b-256 checksum
How to use checksums
a90f9812a6f5df9cf598d4cf86ec77532abbfb0b78d5f1ade970256aa69a7c06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.2.1 This release

4 release files

1.2.0

4 release files

1.1.2

5 release files

1.1.1

4 release files

1.1.0

3 release files

1.0.1

2 release files

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page