Barcodes printed using Crystal Reports via vb.net can't be scanned

34 views Asked by At

posting here after trying several solutions with no luck. I have a vb.net application that calls to print a Crystal Report. The CR report is a label with a barcode and some text.

If I print the label direct from Crystal Reports it will scan with barcode scanner OK, but when I use the vb.net application to send the parameters it does not. I am using Code39-Digits barcode.

Here is the vb.net code:

Dim RptDocument As New ReportDocument
Dim FName As String = GetResults.Rows(0)(1)
Dim SName As String = GetResults.Rows(0)(2)

Dim PatName As String = FName + ". " + SName
RptDocument.Load("MiniLabels.rpt")
RptDocument.SetParameterValue(0, txtBarcode.Text)
RptDocument.SetParameterValue(1, PatName)
RptDocument.PrintOptions.PrinterName = "MiniLabels"
RptDocument.PrintToPrinter(1, False, 0, 0)

On Crystal Report side I have a parameter and a formula. The formula adds an asterisk to the start and end of parameter string as is required for Code39 barcode:

"*" + {?labid} + "*"

enter image description here

I have attempted to use Code39 printer font instead however that just ends up printing plain text via vb.net application, but works fine direct out of Crystal Reports. I also tried adding the asterisks in the vb.net code instead and not using a formula field in CR but that also did not work.

Hoping someone can help me here.

2

There are 2 answers

0
MilletSoftware On

Your approach may rely on a combination of special font (which you indicate is available on the server) and a UFL (User Function Library). So you probably need to install the UFL on the server as well.

0
BrettFK On

Thanks for everyones responses - As it turns out the labels we are using aren't big enough for a Code39 barcode in a big enough font. We're making the switch to Code128 to see if we can make that work.

Turns out once you try a font smaller than around 20pt the Code39 won't scan...