I created a SSRS Report which contains a few Code128 Barcodes. The Barcodes are generated using the latest zxing.net library. I would like to include tabs (char(9)) in an Code128 Barcode. But it fail with the following exception message:
System.ArgumentException: Bad character in input:
Needless to say that it works like a charm without the tabulator character.
The GetBarCodeHorizontal
is used in the report to generate the barcodes. However, for testing purpose i wrapped it into a visual studio vb project:
Class MainWindow
Public Function GetBarCodeHorizontal(ByVal s As String, ByVal width As Integer) As Byte()
Dim writer As New ZXing.BarcodeWriter()
Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream()
writer.Format = ZXing.BarcodeFormat.CODE_128
writer.Options = New ZXing.Common.EncodingOptions
writer.Options.Width = width
writer.Options.Height = 60
writer.Options.PureBarcode = False
'writer.Options.Hints.Add(ZXing.EncodeHintType.CHARACTER_SET, "UTF-8")
Dim bmp As System.Drawing.Bitmap = writer.Write(s)
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
Dim imagedata As Byte()
imagedata = ms.GetBuffer()
Return imagedata
End Function
Private Sub MainWindow_OnLoaded(sender As Object, e As RoutedEventArgs)
Try
Dim barCodeHorizontal = GetBarCodeHorizontal("3999999 80 1XXXXXX8 r1XX3", 200)
Catch ex As Exception
Console.WriteLine(ex)
End Try
End Sub
End Class
Questions:
- How can i solve this problem?
- Is this a limitation of the zxing library?
- Is there any suitable workaround (or maybe even another library)?