Reputation: 1700
i need to print a Barcode128 in Crystal Report, with a c# windows form. The input string is like this:
123456-abcdef-abc
I use barcode.dll to build the formatted 128barcode:
string encodedText = BarCode.BarcodeConverter128.StringToBarcode("123456-abcdef-abc");
string path = @"D:\Projects\mypath\myreport.rpt";
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(path);
cryRpt.SetParameterValue("@inputString", encodedText);
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
in crystalReportViewer1, the textbox font is "Code 128"
it shows a barcode, but it is not readable from any barcode reader. What's wrong?
Here is the barcode generated:
Image updated! the same issue.
Thanks in advance for any help.
Upvotes: 2
Views: 2635
Reputation: 4001
Here is an image demonstrating how a Crystal Report UFL renders the barcode without any font dependencies. The UFL generates the image on the fly and directs an image object Graphic Location expression to the resulting image file. Barcode Image Generated as Image via CUT Light UFL
Upvotes: 1
Reputation: 1766
You have what I call a "blur code". The software in Crystal Reports, is attempting to make your image look smoother using anti-aliasing. Another concern I have is that even if the image were sharpened, it would not scan due to the bars and spaces being the wrong width.
Here is an image zoomed in on your barcode and a clear image of your string represented in Code 128B overlain. The bars and spaces do not line up. In other words, even if the symbol in your attached image were clearer, you may even have an unreadable barcode. What I suspect is that your barcode may only be showing the right half of the entire barcode and the left half is being cut off by some bounding box that is not wide enough. Your barcode.dll may also be using Code 128C on the first 6 characters to save two characters in the width of the barcode because even if you scale the top barcode to line up character-wise, the checksum character does not seem to match.
I don't know much about Microsoft technologies, so I can't help you with that, except to say that you may want to try making the font something ridiculously huge and scaling the page to see if that fixes the anti-aliasing issue.
I'm hoping you can flip a switch in Crystal Reports that will get it to stop auto-anti-aliasing, then fix the bounding box issue.
Upvotes: 1