Data Matrix 2D Barcodes in SQL Server Reporting Services SSRS -As Images
How to (easily) create barcodes in SSRS
- BarCodeWiz Data Matrix Fonts may be used to create barcodes as images in SSRS.
- Follow the steps below to add barcodes to your own report.
![](https://media.barcodewiz.com/images/e262468d-fb82-42e1-b33d-2579e129d732-dm_ssrs_images001.png)
Before You Begin
- Ensure BarCodeWizFonts.DataMatrix.dll as well as the font files are installed on the server.
- See BarCodeWiz Fonts in SSRS - Installation
Step 1. Configure Report Properties
- Open Properties Window - right-click in the report background area and click Report Properties...
![](https://media.barcodewiz.com/images/15fd5784-02a6-4b30-8e84-157909459ff7-ssrsdll2.png)
Add Reference:
- In the Report Properties window, select the References section.
- 1) Click Add to add the assembly
- 2) Type: BarCodeWizFonts.DataMatrix
- 3) Click Add to add a class instance
- 4) Type BarCodeWizFonts.DataMatrix.DataMatrixFonts for class name and MyDataMatrix for instance name
![](https://media.barcodewiz.com/images/b12d7679-ac50-484f-b74a-0adbbd061064-dm-ssrs2_1.png)
Step 2. Insert image
- Insert an image into the report by dragging one of the columns from your DataSet.
- In this example, the image is placed inside a Table.
![Insert an image object into your report to encode Data Matrix barcode using BarCodeWiz Data Matrix Fonts](https://media.barcodewiz.com/images/573aa4cb-ba0a-4730-af44-f1ad58905b1e-dm_ssrs_images002.png)
Step 3. Edit Image Properties.
- 1) Right - click on an image and select Properties
- 2) Select Database as the image source
- 3) Select image/png as the MIME type
- 4) Click on the Fx button to open the Expression window
![](https://media.barcodewiz.com/images/95e25465-cb42-4f61-b945-a229d60749e0-ssrs004.png)
- Set the value for the expression:
=Code.MyDataMatrix.ToImageBytes( Code.MyDataMatrix.Encode( Fields!item_sku.Value, quietZoneWidth:=5 ), "BCW_DM", 8, 300.0 )
- This creates a PNG image with font name BCW_DM, size 8pt, and resolution of 300DPI.
- Replace item_sku with the name of the field from your dataset.
NOTE: For smaller barcodes, you can set the point size as low as 2pt
![](https://media.barcodewiz.com/images/184fb156-2dd9-4c1e-8b2f-6f0f9d8aa181-dm-ssrs_images005.png)
The report is ready!
- Preview the generated report.
![Preview of a report made in SSRS with barcodes encoded as images using BarCodeWiz Data Matrix Fonts](https://media.barcodewiz.com/images/d8c5f058-c986-41a7-bbcd-98c334db2c34-dm_ssrs_images006.png)