Skip to main content

A PDF417 barcode decoder

Project description


Image of a PDF417 barcode

pdf417decoder is a pure Python library for decoding PDF417 barcodes.

Reader is capable of Error Detection and Correction according to the standards for PDF417 which you can read about here ISO/IEC 15438:2006 or download an older version of the PDF this website.


Use the package manager pip to install pdf417decoder.

pip install pdf417decoder


from PIL import Image as PIL
from pdf417decoder import PDF417Decoder

image ="barcode.png")
decoder = PDF417Decoder(image)

if (decoder.decode() > 0):
    decoded = decoder.barcode_data_index_to_string(0)

Testing Results

This library was tested using pdf417gen to create random barcodes and blurred with OpenCV to test error correction. PyTest is used with several test images to show the libraries capability to decode barcodes in the following test cases.

  • Binary data
  • Multiple barcodes
  • Upside down barcode
  • Rotated barcode
  • Error Corrections: Corrupted data due to blurred barcode
  • Error Corrections: Missing data due marks concealing barcode
  • Character type transitions (Upper, Lower, Mixed and Punctuation)


Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.



This project is a derivative of code licensed under the Code Project Open License (CPOL). The Code Project Open License (CPOL) is intended to provide developers who choose to share their code with a license that protects them and provides users of their code with a clear statement regarding how the code can be used.


Source code is a port of a C# Library created and maintained by Uzi Granot. PDF417 Barcode Decoder .NET Class Library and Two Demo Apps

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

pdf417decoder-1.0.8.tar.gz (37.2 kB view hashes)

Uploaded Source

Built Distribution

pdf417decoder-1.0.8-py3-none-any.whl (36.8 kB view hashes)

Uploaded Python 3

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