We are using the following code to generate 1D barcodes. I am dumb and am trying to change the TYPE to QRCode. surprise surprise it is not working. I am thinking that the DLL is only for 1D, but just checking here to confirm before I start looking for another barcode dll.
Public Function Convert(Text As String) As Byte()
Dim b As System.Drawing.Bitmap
bar.Alignment = BarcodeLib.AlignmentPositions.LEFT
bar.IncludeLabel = False
bar.RotateFlipType = Drawing.RotateFlipType.RotateNoneFlipNone
b = bar.Encode(BarcodeLib.TYPE.CODE128, Text, 1300, 300)
Dim bitmapData As Byte() = Nothing
Using ms As New System.IO.MemoryStream()
b.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)
bitmapData = ms.ToArray()
End Using
Return bitmapData
End Function
An easy “work around” is to make a web call to a service like this
that returns a PNG Image form the URL that is a QR Code.
WebClient wc = new WebClient();
byte[] bytes = wc.DownloadData("https://api.qrserver.com/v1/create-qr-code/?data=EPICOR IS AWESOME &size=220x220&margin=0");
MemoryStream ms = new MemoryStream(bytes);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
pictureBox1.Image = img;
Even in VB just for this example… shudder
Dim wc As New WebClient()
Dim bytes As Byte() = wc.DownloadData("https://api.qrserver.com/v1/create-qr-code/?data=EPICOR IS AWESOME &size=220x220&margin=0")
Dim ms As New MemoryStream(bytes)
Dim img As System.Drawing.Image = System.Drawing.Image.FromStream(ms)
pictureBox1.Image = img
I am doing this is a SSRS report. Not able to get the code to work as easy as you have shown. There might be some references I need to use. Let me check on that.
AH! Then maybe even easier. Just stick an image on the report and set the Source of the image to be that External URL (formed using an Expression combined with whatever field holds your value)