今天就跟大家聊聊有關asp.net中怎么利用Zxing庫輸出條形碼,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
首先要在項目中添加zxing.dll引用
其次就是建立aspx文件,在后臺中代碼如下
using ZXing.Common; using ZXing; using ZXing.Rendering; using System.Drawing; using System.Drawing.Imaging; using ZXing.QrCode.Internal; namespace zxingtm { public partial class txm : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MultiFormatWriter mutiWriter = new MultiFormatWriter(); BitMatrix bm = mutiWriter.encode("123456789", BarcodeFormat.CODE_39, 363, 150); Bitmap img = new BarcodeWriter().Write(bm); img.Save("d:/1.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg); } } }
代碼中“123456789”在測試中我是寫死的,用的時候可以用變量代替。BarcodeFormat.CODE_39等參數可以換成其他的,用以生成其他格式的條形碼
看完上述內容,你們對asp.net中怎么利用Zxing庫輸出條形碼有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。