Skip to Content
0

Questions about barcodes printed using Crystal Reports

Feb 09 at 04:19 AM

81

avatar image

If you create a barcode using Crystal Reports and output it to PDF, the barcode scanner will recognize the barcode normally.

However, when exportting to Word, the barcode is not recognized by the barcode scanner.

Even if you look at the output, the results of the barcode in Word and PDF are different.

I am using Visual Studio 2008 and the Crystal Report product version is 11.5.12.1838.

Windows 7, 10 the same phenomenon appears.

The font uses CCodeI2of5_S4.

I can not find a solution to the problem of barcode output when exportting to word.


'===============================================================
'Encode_I2of5

Dim data as string
Dim chk as Number

'Replace "12345678" with your data field here
data = "12345678"

'Set Check Digit to 0 or 1
chk = 0

Dim Result As String
Dim datalength as Number

Dim barcodechar As String
Dim barcodevalue as Number

Dim filtereddata As String
Dim filteredlength As Number
Dim transformdata As String
Dim cd as string

Dim x as number
Dim z as number

cd = ""
transformdata = ""
Result = ""
datalength = Len(data)


'Filter Input
For x = 0 To datalength - 1
barcodechar = Mid(data, x + 1, 1)

If AscW(barcodechar) <= AscW("9") And AscW(barcodechar) >= AscW("0") Then
Result = Result + barcodechar
End If


Next x

filtereddata = Result
filteredlength = Len(filtereddata)

'Encoding
If chk = 1 Then

If filteredlength > 253 Then
filtereddata = Left(filtereddata, 253)

End If

If (Len(filtereddata) Mod 2 = 0) Then 'Make it odd number of digits
filtereddata = "0" + filtereddata
End If

Dim generateCheckDigit_I2of5 as String
Dim toggle as number
Dim sumx as number
Dim lastcharpos as number
Dim ResultVal as number

barcodechar = ""
barcodevalue = 0
toggle = 1
sumx = 0

generateCheckDigit_I2of5 = ""

lastcharpos = Len(filtereddata) - 1
For x = lastcharpos To 0 Step -1

barcodechar = Mid(filtereddata, x + 1, 1)
barcodevalue = (AscW(barcodechar) - 48)

If toggle = 1 Then
sumx = sumx + (barcodevalue * 3)
toggle = 0
Else
sumx = sumx + barcodevalue
toggle = 1
End If
Next x

If ((sumx Mod 10) = 0) Then
ResultVal = AscW("0")
Else
ResultVal = (10 - (sumx Mod 10)) + AscW("0")
End If

generateCheckDigit_I2of5 = Chr(ResultVal)
cd = generateCheckDigit_I2of5

Else

If filteredlength > 254 Then
filtereddata = Left(filtereddata, 254)
End If

If (Len(filtereddata) Mod 2 = 1) Then 'Make it even number of digits
filtereddata = "0" + filtereddata
End If

End If

filtereddata = filtereddata + cd



Dim getI2of5Character as string
Dim inputvalue as Number
Dim num as number

Result = ""
num = 0
For x = 0 To Len(filtereddata) - 1 Step 2

num = Val(Mid(filtereddata, x + 1, 2))

getI2of5Character = ""
inputvalue = num
If (inputvalue <= 90) And (inputvalue >= 0) Then
inputvalue = inputvalue + 32
ElseIf (inputvalue <= 99) And (inputvalue >= 91) Then
inputvalue = inputvalue + 100
Else
inputvalue = -1
End If
getI2of5Character = Chr(inputvalue)

Result = Result + getI2of5Character

Next x

Result = "{" + Result + "}"



formula = Result

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Vitaly Izmaylov
Feb 09 at 07:07 PM
0

How the results of the barcode are different in Word and PDF? Is the bar truncated on a side or at the bottom?

Does it work with another Font?

Note, when report exported to PDF, the font (if embedable) gets embedded into the PDF file. You can see what embedded in File > Properties > Fonts tab. In case with Word, the font or closest to it is loaded from the Windows Fonts.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

In Word and PDF, the result of the barcode is printed without truncation.
The following bar codes are the result of outputting the same bar code number.
The PDF barcode is recognized by the barcode scanner and the Word barcode is not recognized.
Both Word and PDF fonts were output as CCodeI2of5_S4.
No other fonts were found that work with Word.

http://blog.naver.com/gpdls4830/221206748349

0
Vitaly Izmaylov
Feb 13 at 05:39 PM
0

You wrote "No other fonts were found that work with Word".

Does it mean if you create a text manually in Word and then change it to CCodeI2of5_S4 font and it will generate a barcode that scanner can read?

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Feb 14 at 09:57 PM
0

CR 11.5 is not supported in VS 2008, only one that was is CR Basic (version 10.5) included with VS.

Or CR 2008 would work with VS 2008.

To upgrade to the ONLY supported .NET SDK go here, requires VS 2010 -> 2017:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

Now the font issue, I download that font from this link:

https://en.m.fontke.com/font/22430464/download/

I get the same results, exporting to PDF and the barcode can be scanned. I have a scanner for testing. I used your formula in CRD to generate the barcode.

Exporting to Word and the View and print out has some extra bars attached to the end of the barcode.

So I exported to PDF, which can be scanned. From PDF Writer I then exported the report to Word and Word again appended some extra characters onto the end of the barcode.

So this is not a CR issue, contact Microsoft and get them to fix this Font issue.

Don

Share
10 |10000 characters needed characters left characters exceeded