Skip to main content

Library to generate PDFs for printing labels

Project description

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/blairbonnett/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/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylabels-1.2.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pylabels-1.2.0-py3.4.egg (25.5 kB view details)

Uploaded Egg

pylabels-1.2.0-py2.py3-none-any.whl (16.5 kB view details)

Uploaded Python 2Python 3

pylabels-1.2.0-py2.7.egg (25.3 kB view details)

Uploaded Egg

File details

Details for the file pylabels-1.2.0.tar.gz.

File metadata

  • Download URL: pylabels-1.2.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pylabels-1.2.0.tar.gz
Algorithm Hash digest
SHA256 134a1989dfdd9da6579d819781c556a96d41d72b427d5c423dfe23b6f7fda8bd
MD5 dc026f87e86064a33e3c8a582e57e4de
BLAKE2b-256 9d031cf16baf8d493b7843c03b76e01a3855d14d3427609725106a613549001d

See more details on using hashes here.

File details

Details for the file pylabels-1.2.0-py3.4.egg.

File metadata

  • Download URL: pylabels-1.2.0-py3.4.egg
  • Upload date:
  • Size: 25.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pylabels-1.2.0-py3.4.egg
Algorithm Hash digest
SHA256 fdfc87d26ff5baded8e815e1bf823a83d1464541ddd52dc1c6ea526192fb7a2e
MD5 911616d793cec1e3d8a649a9e70cc7fb
BLAKE2b-256 430a9e7cd31e30ae1b6ab6ff41b2bc42ceba2e6e9d67acb7f78fb5167201bfea

See more details on using hashes here.

File details

Details for the file pylabels-1.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pylabels-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 975fe093df84bb7d599d39181dd740c75f0af79c5fa42dcfe1212f0127d0d32e
MD5 ddaab6ea61b8228bac507622eb70333e
BLAKE2b-256 13d2678ad95861849da495efd21e426eef96f1bb266c119cb54fff0293b34151

See more details on using hashes here.

File details

Details for the file pylabels-1.2.0-py2.7.egg.

File metadata

  • Download URL: pylabels-1.2.0-py2.7.egg
  • Upload date:
  • Size: 25.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pylabels-1.2.0-py2.7.egg
Algorithm Hash digest
SHA256 9601e437126af2f1f4600760e79da0b71995f3f69a41ffe21454ba155bd47f11
MD5 11fed2596f333c0b1bb9dcb3822acc40
BLAKE2b-256 7d2731357a0fc0f6fa2c3c082eca1687ed3cf2213f236cba70ab9ec6ae5cb160

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page