
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Product Page δΈ¨ Documentation δΈ¨ Examples δΈ¨ Forum δΈ¨ Temporary License δΈ¨ Customized Demo
Spire.Barcode for Python is a powerful and flexible Python API for barcode generation and recognition. It is designed to cater to the needs of developers to integrate barcode processing capabilities into their Python applications.
With support for various barcode formats, including 1D and 2D barcodes, this library streamlines the procedures involved in generating, reading, and scanning barcodes, making it suitable for a variety of use cases, such as inventory management, product labeling, document tracking, and more.
from spire.barcode import *
# Function to write all bytes to a file
def WriteAllBytes(fname: str, data):
with open(fname, "wb") as fp:
fp.write(data)
fp.close()
# Create an instance of BarcodeSettings
barcodeSettings = BarcodeSettings()
# Set the type of barcode to Code128
barcodeSettings.Type = BarCodeType.Code128
# Set the data for the barcode
barcodeSettings.Data = "12345"
# Set the Code128SetMode type of barcode to Auto
barcodeSettings.Code128SetMode = Code128SetMode.Auto
# Create an instance of BarCodeGenerator with the specified settings
barCodeGenerator = BarCodeGenerator(barcodeSettings)
# Generate the image for the barcode
barcodeimage = barCodeGenerator.GenerateImage()
# Write the PNG image to disk
WriteAllBytes("Code128.png", barcodeimage)
from spire.barcode import *
# Function to write all bytes to a file
def WriteAllBytes(fname:str,data):
fp = open(fname,"wb")
fp.write(data)
fp.close()
# Initialize a new instance of BarcodeSettings
barcodeSettings = BarcodeSettings()
# Set the barcode type to QR Code
barcodeSettings.Type = BarCodeType.QRCode
# Specify the background color as WhiteSmoke
barcodeSettings.BackColor = Color.get_WhiteSmoke()
# Set the QR Code data mode to Byte
barcodeSettings.QRCodeDataMode = QRCodeDataMode.Byte
# Choose the error correction level (ECL) as M
barcodeSettings.QRCodeECL = QRCodeECL.M
# Set whether to display text at the bottom of the barcode
barcodeSettings.ShowTextOnBottom = True
# Define the horizontal offset (not sure what this does exactly)
barcodeSettings.X = 3
# Store the data to be encoded in variables and set it on the settings
data = "ABC 123456789"
barcodeSettings.Data2D = data
barcodeSettings.Data = data
# Add a logo image to the QR Code
barcodeSettings.SetQRCodeLogoImage("data/Logo.png")
# Create a new instance of BarCodeGenerator using the provided settings
barCodeGenerator = BarCodeGenerator(barcodeSettings)
# Generate the barcode image
barcodeimage = barCodeGenerator.GenerateImage()
# Write the resulting image to a file
WriteAllBytes("AddLogoImageQRCode.png", barcodeimage)
from spire.barcode import *
# Function to append all lines of text to a file
def AppendAllText(fname: str, text: List[str]):
# Open the file in write mode
fp = open(fname, "w")
# Iterate over each line of text
for s in text:
# Write the line to the file
fp.write(s)
# Close the file handle
fp.close()
# Use BarcodeScanner class to scan a file using the specified barcode type
strCode = BarcodeScanner.ScanFileWithBarCodeType("data/QRCode.png",BarCodeType.QRCode)
# Append all scanned strings to a text file
AppendAllText("ScanFileWithBarCodeType.txt",strCode)
Product Page δΈ¨ Documentation δΈ¨ Examples δΈ¨ Forum δΈ¨ Temporary License δΈ¨ Customized Demo
FAQs
A 100% standalone Barcode Python API for Processing Barcode Files
We found that Spire.Barcode demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.