Created
June 19, 2026 09:47
-
-
Save aspose-com-gists/56521ac3e1182585b1e22b5ad7d3ead2 to your computer and use it in GitHub Desktop.
Generate Upc Barcode in .NET
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
| // Generate Upc Barcode in .NET | |
| // Read the full guide here: https://blog.aspose.com/barcode/generate-upc-barcode-in-dotnet/ | |
| using System; | |
| using Aspose.BarCode.Generation; | |
| namespace UpcBarcodeDemo | |
| { | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| // UPC‑A example (12 digits, includes checksum) | |
| var upcAGenerator = new BarcodeGenerator(EncodeTypes.UpcA, "012345678905"); | |
| upcAGenerator.Parameters.ImageFormat = ImageFormat.Png; | |
| upcAGenerator.Parameters.ImageResolution = 300; | |
| upcAGenerator.Save("upc_a.png"); | |
| // UPC‑E example (8 digits, includes checksum) | |
| var upcEGenerator = new BarcodeGenerator(EncodeTypes.UpcE, "01234565"); | |
| upcEGenerator.Parameters.ImageFormat = ImageFormat.Png; | |
| upcEGenerator.Parameters.ImageResolution = 300; | |
| upcEGenerator.Save("upc_e.png"); | |
| Console.WriteLine("UPC barcodes generated successfully."); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment