Java中的BarCode图像生成器 [英] BarCode Image Generator in Java

查看:511
本文介绍了Java中的BarCode图像生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Java中创建条形码图像?我需要一些能让我输入数字并生成相应条形码图像的东西。是否有可用于此类任务的免费库?

How can I create a barcode image in Java? I need something that will allow me to enter a number and produce the corresponding barcode image. Is there a free library available for this type of task?

推荐答案

iText 是一个很棒的Java PDF库。他们还有一个用于创建条形码的API。您无需创建PDF即可使用它。

iText is a great Java PDF library. They also have an API for creating barcodes. You don't need to be creating a PDF to use it.

此页面包含创建条形码。以下是该网站的示例:

This page has the details on creating barcodes. Here is an example from that site:

BarcodeEAN codeEAN = new BarcodeEAN();
codeEAN.setCodeType(codeEAN.EAN13);
codeEAN.setCode("9780201615883");
Image imageEAN = codeEAN.createImageWithBarcode(cb, null, null);

您需要确定的最重要的事情是您需要什么类型的条形码。有许多不同的条形码格式,iText确实支持很多。在确定此API是否适合您之前,您需要知道所需的格式。

The biggest thing you will need to determine is what type of barcode you need. There are many different barcode formats and iText does support a lot of them. You will need to know what format you need before you can determine if this API will work for you.

这篇关于Java中的BarCode图像生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆