I am working on modifying an SSRS report and to change the Code 39 barcodes to Code 128. Does anyone know the font name for this? Does Epicor have a Code 128 font?
Thanks!
I am working on modifying an SSRS report and to change the Code 39 barcodes to Code 128. Does anyone know the font name for this? Does Epicor have a Code 128 font?
Thanks!
There is no Code 128 “font”, the barcode is generated from the data you wish to display and includes a check digit for verification. There are Code 128 “generators” online or you can purchase them.
I used the instructions from the first answer on this page …
Worked perfectly.
Thanks, i followed the instructions, but my barcode will not read.
Barcode looks different from what I generate with a Part Number of S-1880
Double check all steps of the instructions have been followed. I create labels using Report Builder on the server that SSRS runs on then all the .dlls and fonts etc are in the correct place when Epicor triggers them.
Barcodes need an * at either end to read. You didn’t forget that did you?
Also, is you scanner set up to read that symbology? It’s possible that it got turned off?
Code-128 barcode do not need * at either end, that is more required by Code39.
When I try and scan the code below with a scanner set up to read all barcodes it does not recognize it.
The start and end codes along with the quiet zone and checksum are all calculated by the code so you only need to supply the text.
I am still trying to figure out what the Epicor SaaS people can do for Cod128 AND DataMatrix?
When i spoke with a “Cloud Team” member and mentioned that Datamatrix is common for the ITAR/DFARS sector he said “Datamatrix - never heard of it”.
DaveO
I have often been surprised by scanning a non-working code into Notepad, to find that something changed and what I think I’m scanning isn’t.
I’ve had Bartender both add and strip the * for example, or I’ve had a typo in whatever I entered.
This is what I have setup (@Banderson @mark.yates) :
Function StringToBarcode(value As String) As String
Dim charPos, minCharPos As Integer
Dim currentChar, checksum As Integer
Dim isTableB As Boolean = True, isValid As Boolean = True
Dim returnValue As String = String.Empty
If (value Is Nothing OrElse value.Length = 0) Then
Return String.Empty
End If
'Check for valid characters
For charCount As Integer = 0 To value.Length - 1
currentChar = Asc(value.Substring(charCount, 1))
If (Not (currentChar >= 32 AndAlso currentChar <= 126)) Then
isValid = False
Exit For
End If
Next
If Not (isValid) Then Return returnValue
charPos = 0
While (charPos < value.Length)
If (isTableB) Then
'See if interesting to switch to table C
'yes for 4 digits at start or end, else if 6 digits
If (charPos = 0 OrElse charPos + 4 = value.Length) Then
minCharPos = 4
Else
minCharPos = 6
End If
minCharPos = IsNumber(value, charPos, minCharPos)
If (minCharPos < 0) Then
'Choice table C
If (charPos = 0) Then
'Starting with table C
'char.ConvertFromUtf32(205)
returnValue = Chr(205).ToString()
Else
'Switch to table C
returnValue = returnValue + Chr(199).ToString()
End If
isTableB = False
Else
If (charPos = 0) Then
'Starting with table B
returnValue = Chr(204).ToString()
'char.ConvertFromUtf32(204);
End If
End If
End If
If (Not isTableB) Then
'We are on table C, try to process 2 digits
minCharPos = 2
minCharPos = IsNumber(value, charPos, minCharPos)
If (minCharPos < 0) Then
'OK for 2 digits, process it
currentChar = Integer.Parse(value.Substring(charPos, 2))
If (currentChar < 95) Then
currentChar = currentChar + 32
Else
currentChar = currentChar + 100
End If
returnValue = returnValue + Chr(currentChar).ToString()
charPos += 2
Else
'We haven't 2 digits, switch to table B
returnValue = returnValue + Chr(200).ToString()
isTableB = True
End If
End If
If (isTableB) Then
'Process 1 digit with table B
returnValue = returnValue + value.Substring(charPos, 1)
charPos += 1
End If
End While
'Calculation of the checksum
checksum = 0
Dim loo As Integer
For loo = 0 To returnValue.Length - 1
currentChar = Asc(returnValue.Substring(loo, 1))
If (currentChar < 127) Then
currentChar = currentChar - 32
Else
currentChar = currentChar - 100
End If
If (loo = 0) Then
checksum = currentChar
Else
checksum = (checksum + (loo * currentChar)) Mod 103
End If
Next
'Calculation of the checksum ASCII code
If (checksum < 95) Then
checksum = checksum + 32
Else
checksum = checksum + 100
End If
' Add the checksum and the STOP
returnValue = returnValue + _
Chr(checksum).ToString() + _
Chr(206).ToString()
Return returnValue
End Function
Function IsNumber(InputValue As String, CharPos As Integer, MinCharPos As Integer) As Integer
MinCharPos -= 1
If (CharPos + MinCharPos < InputValue.Length) Then
While (MinCharPos >= 0)
If (Asc(InputValue.Substring(CharPos + MinCharPos, 1)) < 48 _
OrElse Asc(InputValue.Substring(CharPos + MinCharPos, 1)) > 57) Then
Exit While
End If
MinCharPos -= 1
End While
End If
Return MinCharPos
End Function
Public Function Code128(ByVal stringText As String) As Byte()
Dim result As Byte() = Nothing
Try
result = GenerateImage("Code 128", StringToBarcode(stringText))
Catch ex As Exception
End Try
Return result
End Function
Public Function GenerateImage(ByVal fontName As String, ByVal stringText As String) As Byte()
Dim oGraphics As System.Drawing.Graphics
Dim barcodeSize As System.Drawing.SizeF
Dim ms As System.IO.MemoryStream
Using font As New System.Drawing.Font(New System.Drawing.FontFamily(fontName), 30)
Using tmpBitmap As New System.Drawing.Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
oGraphics = System.Drawing.Graphics.FromImage(tmpBitmap)
oGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel
barcodeSize = oGraphics.MeasureString(stringText, font)
oGraphics.Dispose()
End Using
Using newBitmap As New System.Drawing.Bitmap(barcodeSize.Width, barcodeSize.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
oGraphics = System.Drawing.Graphics.FromImage(newBitmap)
oGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel
Using oSolidBrushWhite As New System.Drawing.SolidBrush(System.Drawing.Color.White)
Using oSolidBrushBlack As New System.Drawing.SolidBrush(System.Drawing.Color.Black)
oGraphics.FillRectangle(oSolidBrushWhite, New System.Drawing.Rectangle(0, 0, barcodeSize.Width, barcodeSize.Height))
oGraphics.DrawString(stringText, font, oSolidBrushBlack, 0, 0)
End Using
End Using
ms = New System.IO.MemoryStream()
newBitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
End Using
End Using
Return ms.ToArray()
End Function
All looks the same as I am using, assume you installed the Font as per instructions on the machine that generates the SSRS.
Code128 does not have * at the start or end, if you add them then, when scanned they will be in the returned value.
I have a vague memory that I need to restart SSRS to pick up the new font, but that maybe related to somthing else.
The SaaS server is generating the report. It came back with a barcode, so I am assuming that the server already has the font installed. I have tried both asterisks and no asterisks
Very odd, I removed the Font from our Test server and the report returned a blank box so I guess it has a font, maybe the wrong one?