Aspose.BarCode FOSS for Python is a free, open-source library for generating standards-compliant barcodes in pure Python. Install it with pip install aspose-barcode-foss and start creating Code 128, Code 39, EAN-13, EAN-8, QR Code, UPC-A, and UPC-E barcodes. Each barcode renders directly to SVG or PNG with no native dependencies.
The library exposes a high-level generate() function and per-symbology helpers such as barcode.code128(), barcode.qr(), and barcode.ean13(). Every call returns a Barcode object with .to_svg() and .to_png() methods for immediate output. Rendering options including scale, DPI, module dimensions, colors, quiet zone, and human-readable text visibility are controlled through RenderOptions.
Because the library is pure Python with no native Office or imaging dependencies, it runs identically on Windows, Linux, and macOS, including Docker containers and CI runners. The codebase is MIT-licensed and hosted on GitHub. For enterprise features and support, see Aspose.BarCode for Python — Enterprise Product.
barcode.generate("code128", "data") to create any supported barcode by name.barcode.code128(), barcode.qr(), barcode.ean13(), barcode.ean8(), barcode.upca(), and barcode.upce() for type-safe generation.Code128Options, Code39Options, QrOptions, and symbology-specific option classes.barcode.to_svg() to get a standards-compliant SVG string.barcode.to_png() to get PNG image bytes.scale, dpi, module_width, module_height, quiet_zone, foreground_color, background_color, transparent_background, show_text, font_family, and font_size.TextLayoutPolicy implementations handle text placement below each barcode type.PngRenderer and SvgRenderer implement the Renderer interface for extensible output.Aspose.BarCode FOSS is installable with pip install aspose-barcode-foss. There are no native libraries or system packages to install. The library requires Python 3.12 or later.
The API is built around Barcode, EncodeOptions, RenderOptions, and SymbologyRegistry, covering the full generation-to-rendering pipeline. Each symbology is defined by a SymbologyDefinition that bundles a parser, encoder, profile, and text layout policy. The codebase is MIT-licensed, hosted on GitHub, and accepts contributions.
AUTO, CODE_A, CODE_B, CODE_C, or mixed-set modes via Code128EncodeMode.BASE or FULL_ASCII encoding with optional check digit via Code39Options.error_correction_level (L, M, Q, H), version, mask, and encoding_mode (AUTO, NUMERIC, ALPHANUMERIC, BYTE, KANJI) via QrOptions.SymbologyRegistry stores all definitions and resolves symbologies by canonical name or alias.SymbologyProfile provides defaults, capabilities, spec references, and known limitations.BarcodeError is the base, with EncodingError, RenderingError, InvalidInputError, SymbologyNotFoundError, UnsupportedFeatureError, and UnsupportedCapabilityError.InputParser validates data before encoding, catching invalid characters and format violations early.UnsupportedCapabilityError with a descriptive message.Create a Code 128 barcode with the high-level generate() function and render it to SVG.
import aspose_barcode_foss as barcode
bc = barcode.generate("code128", "Hello World")
svg_string = bc.to_svg()
print(svg_string[:80])
Generate a QR Code with specific error correction and render to PNG bytes.
import aspose_barcode_foss as barcode
from aspose_barcode_foss import QrOptions, QrErrorCorrectionLevel
bc = barcode.qr("https://example.com", options=QrOptions(
error_correction_level=QrErrorCorrectionLevel.H
))
png_bytes = bc.to_png()
with open("qr.png", "wb") as f:
f.write(png_bytes)
Use RenderOptions to control scale, colors, and quiet zone for any barcode.
import aspose_barcode_foss as barcode
from aspose_barcode_foss import RenderOptions
bc = barcode.ean13("590123412345")
svg = bc.to_svg(options=RenderOptions(
scale=2.0,
foreground_color="#003366",
quiet_zone=10.0,
show_text=True
))
The library is released under the MIT License. You can use, modify, and redistribute it in both open-source and commercial projects without royalties.
The library supports seven symbologies — Code 128, Code 39, EAN-13, EAN-8, QR Code, UPC-A, and UPC-E.
Barcodes render to SVG via to_svg() and PNG via to_png(). The to_pdf() method exists in the API but raises NotImplementedError in the current release.
Run pip install aspose-barcode-foss. The library requires Python 3.12 or later. It is pure Python with no native dependencies.
Yes. Pass a RenderOptions object to to_svg() or to_png() to control scale, DPI, module dimensions, colors, quiet zone, and human-readable text.
Aspose.BarCode FOSS requires Python 3.12 or later. It is pure Python with no native or C-extension dependencies.
Yes. Create a single BarcodeService instance and call generate() in a loop for each data value. Each call returns a Barcode object that you render independently with to_svg() or to_png().
Pass a symbology-specific options object (e.g. Code128Options, QrOptions, Ean13Options) as the encode parameter to BarcodeService.generate(). Each options class exposes properties specific to that symbology, such as encode_mode for Code 128 or error_correction_level for QR Code.