博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
barcode制作条形码及破解
阅读量:4198 次
发布时间:2019-05-26

本文共 2858 字,大约阅读时间需要 9 分钟。

Barcode for Java

A leading Java barcode generator to be used in J2EE, J2SE environment and Java Reporting (JasperReports and Eclipse BIRT).

Barcode for Java supports generating high quality barcode images in

  • Java Server Side Environment (JSP, Servlet, J2EE, Web Service)
  • Java Application (Swing, Applet, Java Bean)
  • Java Reporting (Jasper Reports, Eclipse BIRT)

Barcode 所支持的条形码类型(太多我就不一一讲了,大家点进官网看吧)

由于我使用条形码,不是为了机器去读,只是为了好看,看上去报表更专业。

在这么多的条形码类型中,我个人认为code11 不但好用,样子也不错。

 

这里贴点使用和介绍(太简单,我也懒的翻译了)

It is used primarily in labeling telecommunications equipment. The symbology is discrete and is able to encode the numbers 0 through 9, the dash symbol (-), and start/stop characters.
Code 11 is not terribly secure in that printing imperfections can quite easily convert one character into another valid character. Data integrity is obtained by using one, or sometimes two, check characters.
Code 11 Barcode for Java supports:
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • - (Dash)

The following code illustrates how to create a barcode in a Java class

 

1            Linear linear = new Linear(); 2            linear.setData("123456789"); 3            linear.setType(Linear.CODE11); 4            linear.renderBarcode("c:/code11.gif");

 

 

  • Create a Linear object (line 1)
  • set Linear object properties (line 2 - 3)
  • save into gif file (line 4)

 

There are two ways to create barcode images in your Java web applications.

  1. This is the simplest way to stream barcode image using our provided barcode servlet classes.
    And it will not save barcode images in your server side.
    • Under demo package, copy barcode folder to your java servlet container like tomcat.
    • To test your installation, goto http://YourDomain:Port/barcode/linear?Data=123456789&Type=CODE11
    • To create barcode image in your JSP or html page, you can pass the url to IMG tag src value. For example, <img src="http://YourDomain:Port/barcode/linear?Data=123456789&Type=CODE11" />
  2. The second method is similar with the way to generate barcode in Java applications.
    • Create a barcode image in server side

       

      1            Linear linear = new Linear(); 2            linear.setData("123456789"); 3            linear.setType(Linear.CODE11); 4            linear.renderBarcode("C:/Tools/Tomcat 5.5/webapps/YourWebApp/bimages/barcode.gif");

       

    • In your JSP page, you can using IMG tag to display generated image, like <img src="http://YourDomain:Port/YourWebApp/bimages/barcode.gif" />

 

The following jasper xml content illustrates how to insert a barcode into JasperReports

Import class BarcodeJasperFactory to report.

     
大家肯定下个包,搞个十几分钟就搞定一个条形码了
多产生几张你会发现恶心的事情出来了,由于barcode这个包不是免费的
不交钱就只能用体验版,体验版会随机在你的条形码中放入红色的barcodelib.com字样
由于产生的位置靠上,我就用一张白色的图片把上半部遮掉了, 虽然扁了点,但效果还不错
这样就可以免费使用相当于正式版的体验版。
最后如果大家如果有正式版的希望能发我个,省得我那么麻烦了

转载地址:http://qjbli.baihongyu.com/

你可能感兴趣的文章
JWT的基本介绍
查看>>
关于nlp-pyltp的基本介绍和使用
查看>>
NLP(二)词袋模型及余弦相似度、编辑距离相似度
查看>>
排坑:调用python包nltk执行报错:raise LookupError(resource_not_found)
查看>>
python批量替换列表中的元素
查看>>
TensorFlow和keras的前世今生以及keras和tf.keras的对比
查看>>
Keras(一)分类模型实战
查看>>
Keras(二)回归模型实战
查看>>
Keras(三)实现深度神经网络
查看>>
sigmoid函数求导、求极值(史上最详细)
查看>>
Keras(四)实现批标准化、激活函数、dropout
查看>>
Keras(五)wide_deep模型
查看>>
Keras(六)keras模型封装转化为sklearn模型、使用超参数搜索
查看>>
排坑:TypeError: handle_get_file_code() got an unexpected keyword argument ‘save_all‘
查看>>
Keras(七)TF2中基础的数据类型API介绍
查看>>
Keras(八)实战自定义损失函数、DenseLayer
查看>>
Keras(九) tf.function函数转换、@tf.function函数转换
查看>>
Keras(十) TF函数签名与图结构
查看>>
Keras(十一)梯度带(GradientTape)的基本使用方法,与tf.keras结合使用
查看>>
Keras(十二)tf_data基础API使用
查看>>