Barcode Rendering Framework - SQL Server 2008 Reporting Services Integration

The SSRS2008 barcode integration is basically a SSRS Custom Report Item (CRI).
A CRI is created in two parts;
  • CRI runtime component
  • CRI design-time component

Both runtime and design-time components are used from Visual Studio when authoring a report whereas only the runtime components are needed by SSRS itself.

The design-time experience in this beta build of BRF CRI is intentionally simple... There are no property type converters or UI type editors to enhance the design-time experience for example - it's just plain and dirty.

After installing the plugin (using the installer provided), create a SSRS report. You will need to add the barcode design time control to your toolbox (the assembly you are looking for is called Zen.Barcode.SSRS.Design and it is installed to %program files%\Microsoft Visual Studio 9\Common7\IDE\Private Assemblies.

Now you can drag a barcode onto your report. For best results, set the bar height first to say 35, then select a symbology (say code128) and the rest of the bar metrics will be automatically populated.

The Text property can contain a fixed value (say 1234) or it can reference an SSRS expression (say =Fields!MyField.Value).
NOTE: If you set the Text value to an expression the designer will render it as though the string is a barcode...

At any time clicking the Preview tab will run the report locally and if all is well, show the report with barcodes.

Currently the rendering logic will place the barcode in the centre of any region you have created for the barcode on the report surface.

TODO: Add information pertaining to changes made to configuration files during install

If you need to show barcodes in the header or footer of your report (and you have installed Barcode Render v3.0.0.0 or higher) then read on…

To show barcodes in the header or footer region requires a small work-around since SSRS does not support placing custom report item objects in the header or footer. This means you have to call into the barcode rendering DLL directly from the report to get the barcode image and then enlist the help of a standard SSRS Image control to present the data on the report – easy! Here how you do it…

1. Setup report references and classes

image

The Zen Barcode DLLs are located in the SSRS bin folder and you will also need to add a reference to System.Drawing to get things to work nicely.

Note: The assembly version number has changed with v3…

2. Setup the report code block to setup the barcode builder when given a barcode

image

This code takes the barcode text and sets up the symbology needed by the reported (in this example we’re using Code-128) and then gets the barcode image data from the barcode builder.

3. Place image control on the header of your report

image

Add the image control dragging from the toolbox, set the MIMEType to image/bmp, set the Source to Database and finally set the Value to the following;

=Code.GetBarcodeImage(ReportItems!InternalReference.Value)

Feel free to swap the value InternalReference to the field you want represented as a barcode…

NOTE: If you reference a DataSet field here then you will have to add a Text Box control that references the same field otherwise SSRS will complain when you attempt to view or preview the report (that’s why the example shown has a Text Box underneath.)

Last edited Jul 15, 2012 at 5:02 PM by dementeddevil, version 3

Comments

umairzubairy Aug 14, 2013 at 6:11 PM 
I am getting the same error as "Justavisita" when deploying the report. Does anybody deploy this to server?
thanks,
Umair.

kh23 Aug 12, 2013 at 5:23 AM 
Hi,

I have tried using this step in Visual Studio and I am able to get the barcode created and printed on the header of the report. However, when I run the rdl file in Report Buider 3.0, it gives me an error message: "Error while loading code module: Zen.Barcode.Core". May I know how should I overcome this issue? Do I have to install anything extra or copy the dll file into another place?

Thanks
Karen

ejc67 Dec 20, 2012 at 8:26 PM 
Hi - I've got the DLL's installed - I get no runtime error but my image is being displayed with a red X in it. No barcodes. I'm using Report Builder 2.0 on SSQL Server 2008 R2. Any suggestions?

manojkumar1987 Oct 9, 2012 at 7:49 AM 
hii
I am using Reportbuilder 3.0 Its working fine thanks a lot.
please tell me how to print barcode vertically in documentation..

Justavisita Aug 25, 2012 at 10:47 AM 
Hi, I've successfully managed to create code 128 barcode usign an image in an SSRS 2008r2 report.

However when deploying to the report server I get the following error:

Error rsProcessingError : Error while loading code module: ‘Zen.Barcode.SSRS, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b5ae55aa76d2d9de’. Details: Could not load file or assembly 'Zen.Barcode.SSRS, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b5ae55aa76d2d9de' or one of its dependencies. The system cannot find the file specified.

I have added this assembly to my report and the barcode is rendering perfectly, why can't I deploy?

Has anybody else had this issue?

Thank you,
Jonathan

wsoranno Nov 14, 2011 at 8:43 PM 
I am working on a mail merge report that will print on the Avery 5911 business card stock.
Part of the setup for this is to use a single cell table.
I have all the columns of data I want in the cell.
When I try to add the "Barcode" cri, the cell of the table is cleared and the only thing left is the Barcode.
Does this version not support using teh Barcode in a table cell?

Thanks Bill

swifty_programmer Aug 19, 2011 at 11:24 AM 
Hi,

I'm using Report Builder 3.0.
How can I use a dll to be able to use your CRI?

I tried using a font, but SSRS 2008 R2 adds unnessecary spacing between my barcode-characters.
This is why I want to use your solution.

Any help is very welcome!

Kind regards,

Lawrence