Set Barcode Checksum using Python

This article guides on how to set a barcode checksum using Python. It has details to set the IDE, a list of steps, and a sample code to enable or disable checksum in barcode using Python. Various barcode types will bee discussed where the checksum is must required or optional.

Steps to Set Barcode 128 Checksum using Python

  1. Import the Aspose.BarCode Module for Python via .NET
  2. Create a License object and load the license file for generating output without a watermark
  3. Instantiate a BarcodeGenerator configured for CODE_39_FULL_ASCII with the given barcode text
  4. Set is_checksum_enabled to NO to generate a barcode without a checksum
  5. Save the barcode image without a checksum in PNG format
  6. Switch is_checksum_enabled to YES to include the checksum
  7. Save the barcode image with checksum.png in PNG format

The above steps explain the process to apply the code 39 or code 128 checksum using Python. Import the Aspose.BarCode module, load the license to avoid watermarks, and create a BarcodeGenerator set to CODE_39_FULL_ASCII with your barcode text. Then save two PNGs: first set is_checksum_enabled to NO and save the barcode without a checksum, switch it to YES, and save the checksum-enabled barcode.

Code to Apply Code 128 Checksum using Python

EnableChecksum defaults to Yes for symbologies that require a checksum and No where a checksum is optional. Aspose API References: Optional checksum for Codabar, Code 39 (Standard/Full ASCII), Italian Post 25, Interleaved 2 of 5, Matrix 2 of 5, MSI, Pharmacode, PatchCode, PZN, Standard 2 of 5. Mandatory checksum includes Codablock F, Code 11, Code 128, Code 16K, Code 32, Code 93, GS1 DataBar (Expanded, Expanded Stacked, Omni-Directional, Stacked, Stacked Omni-Directional, Limited, Truncated), EAN-8/13/14 and add-ons (EAN-2, EAN-5), GS1 Codablock F, GS1 Code 128, IATA 2 of 5, ISBN, ISMN, ISSN, ITF-6/14, OPC, SSCC-14/18, UPC-A/E, UPC-A+GS1-DataBar Coupon, VIN.

This article has clarified the usage of the barcode checksum. To change the QR code color, refer to the article on Change QR code color using Python.

 English