Search⌘ K
AI Features

Reading and Writing PDF417 Codes

Explore how to create and read PDF417 2D barcodes using Python. Understand how to encode data into barcode images and vectors, and decode barcode data from images with Python libraries.

Writing data to the PDF417

Below, we can see a simple example of how to generate a PDF417 barcode.

Python 3.10.4
from pdf417gen import encode, render_image
data = """https://educative.io"""
encoded = encode(data)
image = render_image(encoded)
image.save('output/PDF417_edu.png')

Line 1: First, we import the encode() and render_image() functions from the pdf417gen library.

Line 3: We then define a variable called data with our data. In this ...