How to Generate UPC-E Barcodes in C# .NET Framework
Without UPC-E barcode images, tracking small items in transit would be a nightmare. Thankfully, we can easily generate barcode images for our business with a low-code API solution.
Using the ready-to-run code provided below, we can take advantage of a free API to generate new UPC-E barcode images as PNG files. We just need to pass a 6 digit UPC-E barcode value in our request, and we’ll receive the encoding for our PNG file in response.
To structure our request, we’ll need to start by installing the SDK. We can install via NuGet by running the below command in our Package Manager console:
Install-Package Cloudmersive.APIClient.NET.Barcode -Version 3.0.2
Next, let’s turn our attention to authorization. We’ll need a free API key to authorize our API requests, and this will allow a limit of 800 API calls per month (with no additional commitments; once we reach our total, it will simply reset the following month).
Finally, let’s go ahead and call the function. Let’s copy our API key into the appropriate parameter and pass through our UPC-E barcode string:
using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
using Cloudmersive.APIClient.NET.Barcode.Model;
namespace Example
{
public class GenerateBarcodeUPCEExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new GenerateBarcodeApi();
var value = value_example; // string | UPC-E barcode value to generate from
try
{
// Generate a UPC-E code barcode as PNG file
byte[] result = apiInstance.GenerateBarcodeUPCE(value);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling GenerateBarcodeApi.GenerateBarcodeUPCE: " + e.Message );
}
}
}
}
Just like that, we have a free, low-code UPC-E barcode solution for our small-scale shipping needs.