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

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.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distributions

pylabels-1.2.1-py3.5.egg (25.5 kB view details)

Uploaded Source

pylabels-1.2.1-py2.py3-none-any.whl (16.6 kB view details)

Uploaded Python 2 Python 3

pylabels-1.2.1-py2.7.egg (25.4 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pylabels-1.2.1.tar.gz
Algorithm Hash digest
SHA256 299b4f97b6266427cc5acdb99b4699a8b6f381242f2d73513b892fa8857a073f
MD5 44365282aeb4114cf5665b91a6daed00
BLAKE2b-256 754e0ee2f00b3a6465b1a9eba3e08fa43e066ba0e659e91c7cda07b9c47ef4b3

See more details on using hashes here.

File details

Details for the file pylabels-1.2.1-py3.5.egg.

File metadata

  • Download URL: pylabels-1.2.1-py3.5.egg
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pylabels-1.2.1-py3.5.egg
Algorithm Hash digest
SHA256 422fd5e839c92a3363d4fcd2b90308642aea1382e47e57fc4cfd4f737d4a7111
MD5 ae134c6e8285cb66e30b0dc366723398
BLAKE2b-256 919cdd2357398de0e3d5e1ae534fe95ffb0fcc25ba69cd918460fd1d80025dea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylabels-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 32cad77ff07bac765a2ba9379c81b26fd679693aa4b24a640e5e53b2f3fec7af
MD5 ded5ef681f1043fc7b7db7bdacea2b7d
BLAKE2b-256 64480e6f01193075ad8d4751cb2bebcd8fadaa42a52ec1de6ce17c4933f88f42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pylabels-1.2.1-py2.7.egg
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pylabels-1.2.1-py2.7.egg
Algorithm Hash digest
SHA256 e3ed2b094694b2e9ae7ae429944ef5f546eefb8773c94857d8a9bc3a00906ca4
MD5 647ce47094c0b23ec9ac39cbb9405756
BLAKE2b-256 a90f9812a6f5df9cf598d4cf86ec77532abbfb0b78d5f1ade970256aa69a7c06

See more details on using hashes here.

Supported by

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