How to generate a EAN-8 barcode as a PNG file in Salesforce Apex

Cloudmersive
1 min readJul 11, 2020

I’m going to take a guess that you are not enthused at the idea of figuring out barcode generation using Apex. It’s definitely not my choice for an evening’s entertainment. However, there is hope in sight. I am here today to show you how to set up a barcode generation system for EAN-8 that will be ready in just a few short minutes, with minimal effort required.

First we will need to download this file and extract the client folder to our project:

https://github.com/Cloudmersive/Cloudmersive.APIClient.Apex.Barcode/archive/master.zip

Now we can go ahead and call our barcode generation function:

SwagGenerateBarcodeApi api = new SwagGenerateBarcodeApi();SwagClient client = api.getClient();// Configure API key authorization: ApikeyApiKeyAuth Apikey = (ApiKeyAuth) client.getAuthentication('Apikey');Apikey.setApiKey('YOUR API KEY');Map<String, Object> params = new Map<String, Object>{'value' => 'value_example'};try {// cross your fingersBlob result = api.generateBarcodeEAN8(params);System.debug(result);} catch (Swagger.ApiException e) {// ...handle your exceptions}

Whew! Already done.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.