SSRS 1D to 2D barcode

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

haha yeah QR and 1D are completely two different beasts… You’ll need different DLLs/… or in the very least different calls.

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(" 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(" 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
1 Like

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)



1 Like

That is a lot easier. Crap, I hate it when I find out that I am making things more complicated then it needs to be.

TY TY!!!

1 Like

Is that a different version of report builder than 3.0 ?
is it compatible with sql server 201?

I am using ReportBuilder 3.0

SQL Server 2012 on 2012 Server.