{ "info": { "author": "Ivan Habunek", "author_email": "ivan.habunek@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "===================================\nPDF417 barcode generator for Python\n===================================\n\n.. image:: https://img.shields.io/travis/mosquito/pdf417.svg?maxAge=3600&style=flat-square\n :target: https://travis-ci.org/mosquito/pdf417\n\n.. image:: https://img.shields.io/badge/author-%40mosquito-blue.svg?maxAge=3600&style=flat-square\n :target: https://twitter.com/mosquito\n\n.. image:: https://img.shields.io/github/license/mosquito/pdf417.svg?maxAge=3600&style=flat-square\n :target: https://opensource.org/licenses/MIT\n\n.. image:: https://img.shields.io/pypi/v/pdf417.svg?maxAge=3600&style=flat-square\n :target: https://pypi.python.org/pypi/pdf417\n\n\nEasily encode your data into a 2D barcode using the PDF417 format.\n\n.. image:: https://raw.githubusercontent.com/mosquito/pdf417/master/images/1_basic.jpg\n\nLicensed under the MIT License, see `LICENSE `_.\n\nInstallation\n------------\n\nInstall using pip:\n\n.. code-block::\n\n pip install pdf417\n\n\nCLI\n---\n\nThe ``pdf417gen`` command can be used to generate a barcode from commandline. It\ntakes the input either as an argument or from stdin.\n\n.. code-block:: bash\n\n # Show help\n pdf417gen encode --help\n\n # Encode given text and display the barcode\n pdf417gen encode \"Beautiful is better than ugly\"\n\n # Encode given text and save barcode to a file (extension determines format)\n pdf417gen encode -o barcode.png \"Explicit is better than implicit\"\n\n # Input from a file\n pdf417gen encode < input.txt\n\n # Piped input\n python -c \"import this\" | pdf417gen encode\n\n\nUsage\n-----\n\nCreating bar codes is done in two steps:\n\n* Encode a string to a list of code words using ``encode()``\n* Render the barcode using one of the rendering functions: ``render_image()``,\n ``render_svg()``.\n\nUsage overview:\n\n.. code-block:: python\n\n from pdf417 import encode, render_image, render_svg\n\n # Some data to encode\n text = \"\"\"Beautiful is better than ugly.\n Explicit is better than implicit.\n Simple is better than complex.\n Complex is better than complicated.\"\"\"\n\n # Convert to code words\n codes = encode(text)\n\n # Generate barcode as image\n image = render_image(codes) # Pillow Image object\n image.save('barcode.jpg')\n\n # Generate barcode as SVG\n svg = render_svg(codes) # ElementTree object\n svg.write(\"barcode.svg\")\n\n\nSupports strings (unicode in py2) and byte arrays (str in py2):\n\n.. code-block:: python\n\n # These two inputs encode to the same code words\n encode(u\"love \ud83d\udc94\")\n encode(b\"love \\xf0\\x9f\\x92\\x94\")\n\n # Default encoding is UTF-8, but you can specify your own\n encode(u\"love \ud83d\udc94\", encoding=\"utf-8\")\n\n\n\nEncoding data\n-------------\n\nThe first step is to encode your data to a list of code words.\n\n.. code-block:: python\n\n encode(data, columns=6, security_level=2)\n\nColumns\n~~~~~~~\n\nThe bar code size can be customized by defining the number of columns used to\nrender the data, between 1 and 30, the default value is 6. A bar code can have a\nmaximum of 90 rows, so for larger data sets you may need to increase the number\nof columns to decrease the rows count.\n\n.. code-block:: python\n\n codes = encode(text, columns=12)\n image = render_image(codes)\n image.show()\n\n.. image:: https://raw.githubusercontent.com/mosquito/pdf417/master/images/2_columns.jpg\n\nSecurity level\n~~~~~~~~~~~~~~\n\nIncreasing the security level will produce stronger (and more numerous) error\ncorrection codes, making the bar code larger, but less prone to corruption. The\nsecurity level can range from 0 to 8, and procuces ``2^(level+1)`` error\ncorrection code words, meaning level 0 produces 2 code words and level 8\nproduces 512. The default security level is 2.\n\n.. code-block:: python\n\n codes = encode(text, columns=12, security_level=6)\n image = render_image(codes)\n image.show()\n\n.. image:: https://raw.githubusercontent.com/mosquito/pdf417/master/images/3_security_level.jpg\n\nAuto Numeric Compaction Mode\n----------------------------\n\nThis mode can pack almost 3 digits (2.93) info a symbol character.\nThe words with length less 13 symbols will be invoked as Text\n\n.. code-block:: python\n\n codes = encode(text, numeric_compaction=True)\n\n\nRender image\n------------\n\nThe ``render_image`` function takes the following options:\n\n* ``scale`` - module width, in pixels (default: 3)\n* ``ratio`` - module height to width ratio (default: 3)\n* ``padding`` - image padding, in pixels (default: 20)\n* ``fg_color`` - foreground color (default: ``#000000``)\n* ``bg_color`` - background color (default: ``#FFFFFF``)\n\n.. note::\n\n A module is the smallest element of a barcode, analogous to a pixel. Modules\n in a PDF417 bar code are tall and narrow.\n\nThe function returns a Pillow Image_ object containing the barcode.\n\nColors can be specified as hex codes or using HTML color names.\n\n.. code-block:: python\n\n codes = encode(text, columns=3)\n image = render_image(codes, scale=5, ratio=2, padding=5, fg_color=\"Indigo\", bg_color=\"#ddd\")\n image.show()\n\n.. image:: https://raw.githubusercontent.com/mosquito/pdf417/master/images/4_rendering.jpg\n\nRender SVG\n----------\n\nThe ``render_svg`` function takes the following options:\n\n* ``scale`` - module width, in pixels (default: 3)\n* ``ratio`` - module height to width ratio (default: 3)\n* ``padding`` - image padding, in pixels (default: 20)\n* ``color`` - foreground color (default: `#000000`)\n\nThe function returns a ElementTree_ object containing the barcode in SVG format.\n\nUnlike ``render_image``, this function does not take a background color option.\nThe background is left transparent.\n\n.. code-block:: python\n\n codes = encode(text, columns=3)\n svg = render_svg(codes, scale=5, ratio=2, color=\"Seaweed\")\n svg.write('barcode.svg')\n\nSee also\n~~~~~~~~\n\n* pdf417-php_ - a PHP implementation\n* golang-pdf417_ - a Go implementation\n* Specifications_ - USS-PDF-417\n\n.. _pdf417-php: https://github.com/ihabunek/pdf417-php\n.. _golang-pdf417: https://github.com/ruudk/golang-pdf417\n.. _ElementTree: https://docs.python.org/3.5/library/xml.etree.elementtree.html#elementtree-objects\n.. _Image: https://pillow.readthedocs.io/en/3.2.x/reference/Image.html\n.. _Specifications: https://www.expresscorp.com/public/uploads/specifications/44/USS-PDF-417.pdf", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mosquito/pdf417/", "keywords": "pdf417 2d barcode generator", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pdf417", "package_url": "https://pypi.org/project/pdf417/", "platform": "", "project_url": "https://pypi.org/project/pdf417/", "project_urls": { "Homepage": "https://github.com/mosquito/pdf417/" }, "release_url": "https://pypi.org/project/pdf417/0.8.0/", "requires_dist": null, "requires_python": "", "summary": "PDF417 2D barcode generator for Python", "version": "0.8.0" }, "last_serial": 4457099, "releases": { "0.7.0": [ { "comment_text": "", "digests": { "md5": "1b8b5e2563b1a0cbb10976211d0a7b62", "sha256": "727b1baf6d624b1381625105e1de0e32be9161d3c620a7ac8eb85efdf2ca69f2" }, "downloads": -1, "filename": "pdf417-0.7.0.tar.gz", "has_sig": false, "md5_digest": "1b8b5e2563b1a0cbb10976211d0a7b62", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23100, "upload_time": "2018-10-30T07:53:59", "url": "https://files.pythonhosted.org/packages/98/84/ff3348ee3264dee6692a86e4562699e76fe9001a17bb5aa9a32bdc1acf62/pdf417-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "588cc72592ca8e69f5debff129c900a1", "sha256": "49fb625f099a5d8cc6cb4bba75ea9e32a954e20220f333bbbfeb932dac8ef8e5" }, "downloads": -1, "filename": "pdf417-0.7.1.tar.gz", "has_sig": false, "md5_digest": "588cc72592ca8e69f5debff129c900a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23859, "upload_time": "2018-10-30T20:37:09", "url": "https://files.pythonhosted.org/packages/4b/ce/361d0a26829b0dd7581536c70030fca942edde7cf7f3ceb875de21afa5aa/pdf417-0.7.1.tar.gz" } ], "0.7.2": [ { "comment_text": "", "digests": { "md5": "472f85a7ea202745730799743b13b090", "sha256": "8807fb00103b8e49ed58ce4637e3a0552022660e87a7db539698069a6b2fe7da" }, "downloads": -1, "filename": "pdf417-0.7.2.tar.gz", "has_sig": false, "md5_digest": "472f85a7ea202745730799743b13b090", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24529, "upload_time": "2018-10-31T15:44:35", "url": "https://files.pythonhosted.org/packages/fd/2c/af2410435a5f979ee1a5ad6d83504a4c5527960a0dcbc0da387ab2dd422b/pdf417-0.7.2.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "8f66ca6e31f061f2f1d716c279460f20", "sha256": "ef04f78044891d88423073480e4d091554e95a316a8e5581c9d7aa5832b42595" }, "downloads": -1, "filename": "pdf417-0.8.0.tar.gz", "has_sig": false, "md5_digest": "8f66ca6e31f061f2f1d716c279460f20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23974, "upload_time": "2018-11-06T11:53:23", "url": "https://files.pythonhosted.org/packages/7b/3d/678a172b7d455566e552f3574ee06432eb8b92e3a324aeb47152a3d2cb95/pdf417-0.8.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8f66ca6e31f061f2f1d716c279460f20", "sha256": "ef04f78044891d88423073480e4d091554e95a316a8e5581c9d7aa5832b42595" }, "downloads": -1, "filename": "pdf417-0.8.0.tar.gz", "has_sig": false, "md5_digest": "8f66ca6e31f061f2f1d716c279460f20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23974, "upload_time": "2018-11-06T11:53:23", "url": "https://files.pythonhosted.org/packages/7b/3d/678a172b7d455566e552f3574ee06432eb8b92e3a324aeb47152a3d2cb95/pdf417-0.8.0.tar.gz" } ] }