PDF417 Decoder available in Python
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 = PIL.open("barcode.png")
decoder = PDF417Decoder(image)
if (decoder.decode() > 0):
decoded = decoder.barcode_data_index_to_string(0)
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.
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