在mvc.net应用程序

时间:2017-01-27 04:54:31

标签: asp.net-mvc

当我要扫描桌面上的图像然后没有扫描图像时,我已经通过代码39生成了我的条形码图像。当我打印条形码图像并扫描后也无法正常工作。

public Byte[] getBarcodeImage(string barcode, string file) 
{ 
    try 
    { 
        BarCode39 _barcode = new BarCode39(); int barSize =25; 
        string fontFile = HttpContext.Current.Server.MapPath("~/fonts/FREE3OF9.TTF"); 
        return (_barcode.Code39(barcode, barSize, true, file, fontFile)); 
    } 
    catch (Exception ex) { } 
    return null; 
} 

1 个答案:

答案 0 :(得分:0)

根据this article and the comments within,您首先需要增加条形码。我在64设置了我的。然后,您需要将*字符添加到条形码图像的开头和结尾,如下所示:return (_barcode.Code39($"*{barcode}*", barSize, true, file, fontFile));这应该有效,当您扫描时,您将获得没有*个字符的条形码。

相关问题