How to Generate Printable EAN-13 & EAN-8 Barcodes in Power Automate

Cloudmersive
5 min readNov 4, 2024

--

Getting EAN barcode numbers for any business starts with registering the business with GS1 (the global standards organization for barcodes). After a business receives its unique GS1 Company Prefix, it can assign unique EAN barcode numbers to each product it plans to sell. Physically larger products receive 13-digit EAN barcode numbers (hence EAN-13), while physically diminutive products receive more compact 7–digit EAN barcode numbers (hence EAN-7).

Once those EAN barcode numbers are generated, the question of generating physically scannable EAN barcode images come into play. Barcode images need to be generated and printed from barcode numbers before they can be slapped on the side of any product — and there are a few different ways to handle that.

Generate EAN Barcodes & Convert to PDF in Power Automate

In Power Automate, it’s easy to automate the process of generating EAN barcode images and converting those images to PDF for printing — all in one step & without writing any code along the way.

We can simply use the Cloudmersive Barcode and Cloudmersive Document Conversion connectors in conjunction with one another. The former can generate EAN-8 and EAN-13 barcodes as PNGs, and the latter can convert PNGs to PDF — a more suitable printing format.

In this article, we’ll walk through an example flow that generates several printable PDF barcode images from an array of barcode numbers. We’ll create a manually triggered, instant cloud flow for now so we can have full control over our data.

Create an Instant cloud flow
Trigger the flow manually

The first thing we’ll do is add our Cloudmersive Barcode and Cloudmersive Document Conversion connector actions into our flow.

We’ll add a new action and type “Cloudmersive” into the search bar. This brings up a list of Cloudmersive connectors in alphabetical order, and we’ll find the Cloudmersive Barcode connector at the top of this list.

Search for the Cloudmersive Barcode connector

We’ll click “See more” to view the full actions list, and from there, we’ll select the option to generate an EAN-13 or EAN-8 barcode as a PNG file. In my example, I’m selecting the EAN-8 option.

Look for EAN-13 and EAN-8 options on the Cloudmersive Barcode connector actions list; select one

We’ll need to create our Cloudmersive Barcode connection directly after selecting our EAN action. As long as we have a premium Power Automate license, we can use any Cloudmersive connector for free with a free API key. These a low a limit of 800 API calls per month with zero commitments, and we can get one by creating a free account on the Cloudmersive website.

After we’ve created our connection, we’ll have a single request parameter to fill, which asks for our 8– or 13-digit barcode number.

Review the Generate EAN input parameter

Rather than enter a single barcode number into this field, we’ll use the Compose action (from the built-in Data Operation connector) to create an array of barcode numbers to enter. We’ll add this action before our barcode generating action.

Add the Compose action into your flow

Testing this way will more accurately simulate a production flow dealing with numerous inputs. In my example, I’ve composed an array with three valid (and fake) EAN-8 barcode numbers.

Compose an array of EAN-8 or EAN-13 barcode numbers

We’ll now add an Apply to Each control to consume the Outputs value from our Compose action (which contains our array of EAN numbers).

Create an Apply to Each control that consumes the Compose array

Next, we’ll drag our Generate EAN action into the Apply to Each control and set it to consume the Current item. This will allow Power Automate to create one new barcode image for each item included in our Compose array.

Drag the Generate EAN barcode action into the Apply to Each control and set it to consume the Current item

Now that we’ve generated our barcode PNGs, we’ll convert those PNGs to PDF using the Cloudmersive Document Conversion connector within our Apply to Each control.

To find the Document Conversion connector, we’ll search for Cloudmersive connectors once again, and we’ll scroll down until we find it (with a green logo) on the Cloudmersive connector list.

Search for the Cloudmersive Document Conversion connector

Just like we did before with the Barcode connector, we’ll click “See more” to view the actions list, and we’ll search for the action we want. This time, we’ll look for an action called Convert Document to PDF.

Search for the Convert Document to PDF action

After selecting this action, we’ll create our Cloudmersive Document Conversion connection using the same free API key we previously obtained (for reference — each Cloudmersive action in our flow consumes 1 API call; using two actions on a free connection, we could create 400 barcode PDFs per month with this flow).

We’ll use OutputContent from our Generate EAN action to satisfy our initial request parameter, and we’ll then add a random file name to satisfy the second parameter.

Configure the Convert Document to PDF

Now that we’ve generated PDF file bytes, we’ll add a Create file action in the Apply to Each control to save each new barcode PDF in our file system.

In my example, I’m re-using the Current item (along with some additional text) to name each file appropriately in my system.

Use a Create file action to generate each barcode PDF

After we save and test our flow, we’ll find one new barcode PDF for each barcode included in our original barcode number array.

Save and test the flow
Check the target folder for barcode PDFs
Open a barcode PDF to check its contents

We can now use these PDFs to print our barcode labels before attaching them to our products.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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