Display BarCodes in Report Header and Footer
Overview
In Visual Studio, you cannot use a Custom Report Items in headers or footers. Therefore, BarcodeGenerator visual component cannot be used to render barcode labels in report headers or footers.
The solution is using Custom Code technology and render barcode label as image stream to standard Image Report Item control which can be placed to headers and footers. You can use BarcodeGenerator class instead of BarcodeGenerator visual component.
How to Display Barcodes in a Report Header/Footer
- Create blank report project, right click on report page and select Insert then Page Header.

- Place Image Report item to report page header.

- Open Report Properties section References and add references to the Aspose.BarCode for Reporting Services and System.Drawing.
Aspose.BarCode.ReportingServices System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

- Add current code to the Report Properties section Code.
Public Function GetBarcodeImage(ByVal codetext As String) As Byte() Dim builder As New Aspose.BarCode.Generation.BarcodeGenerator(Aspose.BarCode.Generation.EncodeTypes.QR, codetext) builder.Parameters.Resolution = 300 Dim bitmap As System.Drawing.Bitmap = builder.GenerateBarCodeImage() Dim ms As New System.IO.MemoryStream bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp) Return ms.GetBuffer() End Function

- Return to the Image Report Item, and set properties with these values:
- Source to Database;
- MIMEType to image/bmp;
- Value to =Code.GetBarcodeImage(“Header Code”)

- As a result, on Preview panel you should see something like this:
