Created
June 18, 2026 09:54
-
-
Save aspose-com-gists/ad90556e40dd9155172fbdcb7df1e224 to your computer and use it in GitHub Desktop.
Build Code 93 Barcode Generator in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build Code 93 Barcode Generator in Python | |
| # Read the full guide here: https://blog.aspose.com/barcode/build-code-93-barcode-generator-in-python/ | |
| # Complete working code for generating a Code 93 barcode with Aspose.BarCode for Python via .NET | |
| import aspose.barcode as barcode | |
| from aspose.barcode import BarCodeGenerator, EncodeTypes, BarCodeImageFormat, Color | |
| # Initialize the barcode generator with Code 93 symbology | |
| generator = BarCodeGenerator(EncodeTypes.CODE_93) | |
| # Set the data to be encoded (must be alphanumeric) | |
| generator.code_text = "ABC-1234-XYZ" | |
| # Optional visual customizations | |
| generator.x_dimension = 2.0 # Width of the smallest bar (in points) | |
| generator.bar_height = 100 # Height of the barcode (in points) | |
| generator.fore_color = Color.black # Bar color | |
| generator.back_color = Color.white # Background color | |
| # Save the barcode as a PNG image | |
| output_path = "code93_barcode.png" | |
| generator.save(output_path, BarCodeImageFormat.PNG) | |
| print(f"Barcode saved to {output_path}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment