This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

PubCode is a library that encodes barcodes and allows easy access to the data required to render the barcode. It can optionally use PIL to render the barcode or to provide a data URL containing a single pixel high PNG barcode which can be resized by a browser to a more usefull size.

Supported barcodes

  • Code128

Usage

>>> from pubcode import Code128
>>> barcode = Code128('Hello!', charset='B')

You can access the data required to render the barcode easily and intuitively.

>>> barcode.bars
'2112142311131122142211142211141341112221221212412331112'
>>> barcode.modules  # doctest: +ELLIPSIS
[0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, ...]

You can generate PIL.Image objects from barcodes.

>>> barcode.image()  # doctest: +ELLIPSIS
<PIL.Image.Image image mode=1 size=121x1 at ...>
>>> barcode.image(height=10, module_width=2)  # doctest: +ELLIPSIS
<PIL.Image.Image image mode=1 size=242x10 at ...>

You can also generate data URLs.

>>> barcode.data_url()  # doctest: +ELLIPSIS
'data:image/png;base64,...'

You can also control the exact way in which the barcode is encoded, which allows you to control the size of the resulting barcode.

>>> barcode = Code128('12\x00x\x01', charset='CABA')
>>> barcode.symbols
['[Start Code C]', '12', '[Code A]', '\x00', '[Shift B]', 'x', '\x01', '\x15', '[Stop]']
Release History

Release History

1.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PubCode-1.1.0-py2.py3-none-any.whl (8.3 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Aug 15, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting