{"id":24219,"library":"pdf417gen","title":"pdf417gen","description":"A pure Python library for generating PDF417 2D barcodes. Version 0.8.1 (latest) supports encoding text, bytes, and numbers into PDF417 barcodes, with output as PIL Images, SVG strings, or list of boolean rows. Requires Python >=3.8.","status":"active","version":"0.8.1","language":"python","source_language":"en","source_url":"https://github.com/ihabunek/pdf417-py","tags":["barcode","pdf417","barcode-generator","2d-barcode"],"install":[{"cmd":"pip install pdf417gen","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Import encode function directly; no submodule.","symbol":"encode","correct":"from pdf417gen import encode"},{"note":"Render barcode as a PIL Image.","symbol":"render_image","correct":"from pdf417gen import render_image"},{"note":"Render barcode as an SVG string.","symbol":"render_svg","correct":"from pdf417gen import render_svg"},{"note":"Convert to list of boolean rows for custom rendering.","symbol":"to_legacy_barcodes","correct":"from pdf417gen import to_legacy_barcodes"}],"quickstart":{"code":"from pdf417gen import encode, render_image\nfrom PIL import Image\n\n# Encode a string into barcode codewords\ncodes = encode('Hello, PDF417!')\n\n# Render as PIL Image (returns a PIL Image object)\nimage = render_image(codes)  # type: Image.Image\nimage.save('barcode.png')","lang":"python","description":"Encode a string and render as image. Requires Pillow."},"warnings":[{"fix":"Call `image.save('output.png')` or use `render_image(codes).save('output.png')`.","message":"The function `render_image` returns a PIL Image, not a file path. You must save it explicitly with `image.save('file.png')`.","severity":"gotcha","affected_versions":"all"},{"fix":"Pass a string (e.g., 'data') or bytes for binary data. Use `encode` which returns codewords.","message":"Input must be a string, bytes, or an integer (single codeword). Passing a list of integers not as codewords will produce unexpected results.","severity":"gotcha","affected_versions":"all"},{"fix":"For binary data: `encode(data.decode('latin-1'))` or use `data` directly if it's a string.","message":"In Python 3, the `encode` function expects a string by default. If you pass bytes, it tries to decode as utf-8; to encode raw bytes, convert to string appropriately.","severity":"gotcha","affected_versions":"0.5.0+"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: `from pdf417gen import render_image`","cause":"Forgot to import render_image, or imported from wrong module.","error":"NameError: name 'render_image' is not defined"},{"fix":"Install Pillow: `pip install Pillow`","cause":"Pillow is required for render_image but not installed automatically.","error":"ModuleNotFoundError: No module named 'PIL'"},{"fix":"Use keyword arguments: `encode('data', columns=5)` instead of positional.","cause":"Passed both positional and keyword argument for columns, or incorrect signature.","error":"pdf417gen.encode() got multiple values for argument 'columns'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}