Generate Barcodes in Documents Using Power Automate
In this guide, you’ll learn how to add a barcode to a PDF using Power Automate. This example adds a Codabar to a PDF in Dropbox, but you can easily add a barcode to other file types (see file formats we support).
Here are some of the barcodes we support:
-
QR code
-
Codabar
-
Code 11
-
Code 32
-
Code 39
-
Code 93
-
Code 128 (A/B/C)
-
GS1-128
This example uses Power Automate to add a barcode to a PDF in Dropbox. However, you can easily add barcodes to PDFs in other destinations, like SharePoint, Google Drive, OneDrive, or any platform supported by Power Automate. You can also extend this example by adding additional automation, like sending your file as an email.
Prerequisites
Before building the workflow, ensure all prerequisites are in place. You should also have some knowledge of building workflows using Power Automate.
-
A full or free trial subscription for [Muhimbi Document Converter for Power Automate][]
-
Appropriate privileges to create flows
-
A Dropbox account connected with Power Automate
Using Power Automate to Add a Barcode to PDF
From a high level, the workflow will look like what’s shown below.
Specifying the Folder
Insert the When a file is created (properties only) flow action for Dropbox, and in the Folder field, specify /muhimbi documents
.
*
Inserting a Condition
Insert the Condition flow action and specify List of Files Names, which is the output of the When a file is created (properties only) action. It ends with .pdf
.
Getting the File Content
If the step above evaluates to true
, add Get file content for the Dropbox action in the If yes box. In the File field, enter List of Files Id, which is the output of the When a file is created (properties only) action.
Adding the Barcode Watermark
Insert the Muhimbi Add Linear Barcode watermark action. This workflow action can be used to apply text to the foreground or background of one or more pages in a document with full control over the font, style, size, and color. The text stored in the content field may contain embedded field codes. Power Automate expressions are also supported, which makes it possible for dynamic barcoding — barcode information stored in workflow variables or in an item’s columns — to be embedded in the barcode.
Add the following mandatory fields to the action:
-
Source file content — File Content, which is the output of the Get file content action.
-
Barcode content — Enter the data to be embedded in your barcode. You can use embedded field codes and Power Automate expressions.
-
Barcode type — Specify Codabar for this example.
-
Disable check digit Specify false. This indicates if the check digit has to be calculated or not.
-
Show check digit — Specify true. This indicates if the check digit should be displayed in the barcode label or not.
-
Position — Specify Bottom Center to select the position in the document where you want the watermark to be displayed.
-
Width — 100
-
Height — 50
Creating a File
Insert the Dropbox Create file action after the Add Linear Barcode watermark action.
The action has three main parameters:
-
Folder Path — The path of your destination folder.
-
File name — List of Files Names, which is the output of the When a file is created (properties only) action.
-
File Content — Processed file content, which is the output of the Add Linear Barcode watermark action.
You can test this workflow by uploading a PDF document to the Dropbox location. This will trigger the flow after a minute and create a new document with a barcode.