Giter Club home page Giter Club logo

pylabels's Introduction

======== pylabels

Latest release: 1.2.1

pylabels is a Python library for creating PDFs to print sheets of labels. It uses the ReportLab PDF toolkit to produce the PDF, and works under both Python 2 and Python 3.

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.

Examples

The following examples are available in the demos directory:

  • 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).
  • Repeated - how to use the count parameter to add multiple copies of the same label.
  • 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/.

pylabels's People

Contributors

bcbnz avatar jdidion avatar campenberger avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.