Barcode Generator in Dynamo, IronPython or as a ZeroTouch node

Hello.

Has anyone attempted to create a Barcode Generator similarly to the QR Code generator?

I am asking since PowerBI does not allow using QR codes for report filtering on elements, but it does allow using barcodes.

Any reference to an IronPython library, a zerotouch node or a package would be really appreciated :smiley:

Thanks, Adam

Hello
here an example with a free library

import sys
import clr
import System

clr.AddReference('System.Drawing')
from System.Drawing import *

clr.AddReferenceToFileAndPath(r'C:\Users\poupincyril\Downloads\freespire.barcode.2.3.0\lib\net40\Spire.Barcode.dll')

import Spire.Barcode
from Spire.Barcode import *

path = IN[0]
fullPathPng = path + "\\EAN-14.png"

settings = BarcodeSettings()
settings.Type = BarCodeType.EAN14
settings.Data = "123456789"
settings.UseChecksum = CheckSumMode.ForceEnable
settings.ShowTextOnBottom = True
settings.TextAlignment = StringAlignment.Center
generator = BarCodeGenerator(settings)
image = generator.GenerateImage()
image.Save(fullPathPng, System.Drawing.Imaging.ImageFormat.Png)

OUT = fullPathPng
11 Likes

@c.poupin the above barcode library is has limited license(month). Is there any other recommended library with python code?

Thanks,

unfortunately no, I had not found any other free library (while keeping compatibility with Ironpython2.7)

2 Likes

Hmmmm… there are a lot of web tools out there, perhaps a solution can be found by using DynaWeb or similar?

Lots of open source tools as well, some of which might have a DLL you could call from inside Python to do the work that way…

Worst case UPC format doesn’t seem that complicated; the Wikipedia entry lists what you need to build one with straight Dynamo Python. No way to test accuracy without buying a scanner though, so I can’t be much help there.

All of that said, PowerBI will let you insert images into data sets and tables, perhaps using QR codes as images by this method would be a better use of the time?

2 Likes

A few years ago I created a package that can generate QR codes while working on projects with dynamo, you can check it out and extend problem with example that.
image

Open Source : https://github.com/chuongmep/QRImage
Some demo : QRImage Package Dynamo | Hồ Văn Chương

3 Likes

I get what you’re saying about PowerBI, sometimes it can be frustrating when you can’t use the exact tool you want. I haven’t personally tried the Barcode Generator, but I do know that there are some libraries out there that could be helpful for you.
If you still look for better options, consider using Smart Engines OCR SDK, which has a lot of different functions for working with barcodes and QR codes. I know it’s not specifically an IronPython library or a ZeroTouch node, but it could be worth checking out. Another option you might want to look into is the Barcode Library by Markus Schuetz.