生成条形码图片,然后在前台页面展示:
 <img id="img" src="Mobile/<%=url %>"/>
 public string url;

        protected void Page_Load(object sender, EventArgs e)
{
//string code = Get("6901028045575", 2, 60); //this.barcode.InnerHtml = code; BarcodeLib.Barcode.Linear ean13 = new BarcodeLib.Barcode.Linear();
ean13.Type = BarcodeLib.Barcode.BarcodeType.EAN13;
string code = "";
ean13.Data = code;
ean13.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
ean13.BarColor = Color.Black;
ean13.BarWidth = ;
ean13.LeftMargin = ;
ean13.RightMargin = ;
string path = System.Web.HttpContext.Current.Request.MapPath("/Mobile/") + code + ".jpeg";
ean13.drawBarcode(path);
url = code + ".jpeg";
}

传入data时需要传入12位的数字。

下载地址:http://www.barcodelib.com/asp_net/main.html

下面参考资料转自:http://www.itnose.net/detail/6115587.html

首先效果:

生成,条形码,c#,barcodelib.dll,利用0 :首先下载BarcodeLib.dll 下载地址 http://pan.baidu.com/share/link?shareid=2590968386&uk=2148890391&fid=1692834292 如果不存在了则自行搜索下载。 .BarcodeLib.dll 一维条码库支持以下条码格式 UPC-A UPC-E UPC Digit Ext. UPC Digit Ext. EAN- JAN- EAN- ITF- Codabar PostNet Bookland/ISBN Code Code Code Extended Code LOGMARS MSI Interleaved of Standard of Code Code -A Code -B Code -C Telepen 然后项目中添加引用 [csharp] view plaincopy
private void button6_Click(object sender, EventArgs e)
{
System.Drawing.Image image;
int width = , height = ;
string fileSavePath = AppDomain.CurrentDomain.BaseDirectory + "BarcodePattern.jpg";
if (File.Exists(fileSavePath))
File.Delete(fileSavePath);
GetBarcode(height, width, BarcodeLib.TYPE.CODE128, "20131025-136", out image, fileSavePath); pictureBox1.Image = Image.FromFile("BarcodePattern.jpg");
}
public static void GetBarcode(int height, int width, BarcodeLib.TYPE type, string code, out System.Drawing.Image image, string fileSaveUrl)
{
try
{
image = null;
BarcodeLib.Barcode b = new BarcodeLib.Barcode();
b.BackColor = System.Drawing.Color.White;//图片背景颜色
b.ForeColor = System.Drawing.Color.Black;//条码颜色
b.IncludeLabel = true;
b.Alignment = BarcodeLib.AlignmentPositions.LEFT;
b.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;
b.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;//图片格式
System.Drawing.Font font = new System.Drawing.Font("verdana", 10f);//字体设置
b.LabelFont = font;
b.Height = height;//图片高度设置(px单位)
b.Width = width;//图片宽度设置(px单位) image = b.Encode(type, code);//生成图片
image.Save(fileSaveUrl, System.Drawing.Imaging.ImageFormat.Jpeg); }
catch (Exception ex)
{ image = null;
}
}
简单的写一下。详细的去 http://www.barcodelib.com/net_barcode/main.html 这里看。 利用 zxing.dll生成条形码和二维码 下载地址http://zxingnet.codeplex.com/ ZXing (ZebraCrossing)是一个开源的,支持多种格式的条形码图像处理库, 。使用该类库可以方便地实现二维码图像的生成和解析。 下载zxing.dll 项目参照引用 [csharp] view plaincopy
{
MultiFormatWriter mutiWriter = new com.google.zxing.MultiFormatWriter();
ByteMatrix bm = mutiWriter.encode(txtMsg.Text, com.google.zxing.BarcodeFormat.QR_CODE, , );
Bitmap img = bm.ToBitmap();
pictureBox1.Image = img; //自动保存图片到当前目录
string filename = System.Environment.CurrentDirectory + "\\QR" + DateTime.Now.Ticks.ToString() + ".jpg";
img.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);
lbshow.Text = "图片已保存到:" + filename;
}
catch (Exception ee)
{ MessageBox.Show(ee.Message); } 生成,条形码,c#,barcodelib.dll,利用1 利用 QrCodeNet.dll生成条形码和二维码 下载地址http://qrcodenet.codeplex.com/ 下载QrCodeNet.dll 项目参照引用 [csharp] view plaincopy
private void button2_Click(object sender, EventArgs e)
{
var codeParams = CodeDescriptor.Init(ErrorCorrectionLevel.H, textBox1.Text.Trim(), QuietZoneModules.Two, ); codeParams.TryEncode(); // Render the QR code as an image
using (var ms = new MemoryStream())
{
codeParams.Render(ms); Image image = Image.FromStream(ms);
pictureBox1.Image = image;
if (image != null)
pictureBox1.SizeMode = image.Height > pictureBox1.Height ? PictureBoxSizeMode.Zoom : PictureBoxSizeMode.Normal;
} }
/// <summary>
/// Class containing the description of the QR code and wrapping encoding and rendering.
/// </summary>
internal class CodeDescriptor
{
public ErrorCorrectionLevel Ecl;
public string Content;
public QuietZoneModules QuietZones;
public int ModuleSize;
public BitMatrix Matrix;
public string ContentType; /// <summary>
/// Parse QueryString that define the QR code properties
/// </summary>
/// <param name="request">HttpRequest containing HTTP GET data</param>
/// <returns>A QR code descriptor object</returns>
public static CodeDescriptor Init(ErrorCorrectionLevel level, string content, QuietZoneModules qzModules, int moduleSize)
{
var cp = new CodeDescriptor(); //// Error correction level
cp.Ecl = level;
//// Code content to encode
cp.Content = content;
//// Size of the quiet zone
cp.QuietZones = qzModules;
//// Module size
cp.ModuleSize = moduleSize;
return cp;
} /// <summary>
/// Encode the content with desired parameters and save the generated Matrix
/// </summary>
/// <returns>True if the encoding succeeded, false if the content is empty or too large to fit in a QR code</returns>
public bool TryEncode()
{
var encoder = new QrEncoder(Ecl);
QrCode qr;
if (!encoder.TryEncode(Content, out qr))
return false; Matrix = qr.Matrix;
return true;
} /// <summary>
/// Render the Matrix as a PNG image
/// </summary>
/// <param name="ms">MemoryStream to store the image bytes into</param>
internal void Render(MemoryStream ms)
{
var render = new GraphicsRenderer(new FixedModuleSize(ModuleSize, QuietZones));
render.WriteToStream(Matrix, System.Drawing.Imaging.ImageFormat.Png, ms);
ContentType = "image/png";
}
} 效果:

生成,条形码,c#,barcodelib.dll,利用2 参考地址: http://www.cnblogs.com/mzlee/archive/2011/03/19/Lee_Barcode.html http://blog.163.com/smxp_2006/blog/static/588682542010215163803/ http://q.cnblogs.com/q/15253/ http://www.csharpwin.com/csharpspace/13364r9803.shtml http://www.2cto.com/kf/201304/203035.html

使用BarcodeLib.Barcode.ASP.NET生成条形码的更多相关文章

  1. 基于ASP.NET生成条形码(code128)

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Dr ...

  2. C# 利用BarcodeLib.dll生成条形码(一维,zxing,QrCodeNet/dll二维码)

    原文:http://blog.csdn.net/kongwei521/article/details/17588825 首先效果: 一.下载BarcodeLib.dll 下载地址 :http://do ...

  3. C# 利用BarcodeLib.dll生成条形码

    首先效果: 1:首先下载BarcodeLib.dll 下载地址 http://pan.baidu.com/share/link?shareid=2590968386&uk=2148890391 ...

  4. asp.net 生成、解析条形码和二维码

    原文 asp.net 生成.解析条形码和二维码 一.条形码 一维码,俗称条形码,广泛的用于电子工业等行业.比如我们常见的书籍背面就会有条形码,通过扫描枪等设备扫描就可以获得书籍的ISBN(Intern ...

  5. thinkphp5 + barcode 生成条形码

    1.去官网下载类库 “https://www.barcodebakery.com/en/download”,选择自己的版本下载 2.解压放到“E:\phpstudy\PHPTutorial\WWW\g ...

  6. 条形码(barcode)code128生成代码

    条形码(barcode)code128生成代码 很简单 多些这位兄弟https://bbs.csdn.net/topics/350125614 下面是我的DEMO 直接放到VS2005下面编译即可 # ...

  7. 用Barcode生成条形码图片

    使用第三方类库:BarcodeLib.dll private BitmapImage GenerateBarcodeBitmap(string visitId) { BarcodeLib.Barcod ...

  8. C# 生成条形码

    原文地址:http://www.cnblogs.com/xcsn/p/4514759.html 引用BarcodeLib.dll(百度云中有)生成条形 protected void Button2_C ...

  9. winform生成条形码和二维码(ZXing.Net)

    首先在项目添加ZXing.Net. 工具-->Nuget包管理器-->Nuget程序包  在所搜栏输入 ZXing.Net 如下图: 添加完成后会看见: 效果图: 所有代码: /// &l ...

随机推荐

  1. git使用 ——转

    转自:http://blog.csdn.net/jamesmf/article/details/17483787

  2. Redis 数据结构之简单动态字符串SDS

    几个概念1:key对象 数据库存储键值对的键,总是一个字符串对象.2:value对象 数据库存储键值对的值,可以是字符串对象,list对象,hash对象,set对象,sorted set对象.    ...

  3. 如何让你的webapp也能跳窗口搜索

    目前很多手机app或者一些webapp,搜索栏基本采用跳窗口的搜索方式 怎么做 实现方式: 1.在触发外层的input的时候打开个modal层,默认打开该modal层的时候就触发了moda里面的inp ...

  4. ITFriend创业阶段的server环境搭建手冊

    创业阶段,进一步实践了Linux环境搭建和维护,以下是一些经常使用软件的搭建步骤和參考资料,仅供自己和诸位參考. 我个人还是比較倾向"一站式Web开发"的.自己想做点事.须要太多的 ...

  5. git笔记之安装使用

    git是什么? 简介一下,Git是一个开源的分布式版本号控制系统,用以有效.快速的处理从非常小到非常大的项目版本号管理.Git是眼下世界上最先进的分布式版本号控制系统,没有传说中的之中的一个. Git ...

  6. 基于Qt的A*算法可视化分析

    代码地址如下:http://www.demodashi.com/demo/13677.html 需求 之前做过一个无人车需要自主寻找最佳路径,所以研究了相关的寻路算法,最终选择A算法,因为其简单易懂, ...

  7. MS SQL 日常维护管理常用脚本

    --[查看数据库服务器名称] --默认实例查询 SELECT @@SERVERNAME AS SERVERNAME; SELECT SERVERPROPERTY('servername') AS Se ...

  8. intellij jetBrains phpstorm/webstorm/IDEA 编辑器使用诀窍

    下载地址 https://www.jetbrains.com/products.html?fromMenu 主题/皮肤切换或下载:https://blog.csdn.net/smallxiannoti ...

  9. WatiN自动化测试

    简介 WatiN - Watir的.NET版: http://watin.sourceforge.net/ Welcome at the WatiN (pronounced as What-in) w ...

  10. 文件上传之 MultipartFile

    利用MultipartFile(组件)实现文件上传 在java中上传文件似乎总有点麻烦,没.net那么简单,记得最开始的时候用smartUpload实现文件上传,最近在工作中使用spring的Mult ...