我不想生成扩展 GS1 数据栏类型的条形码。我在谷歌中搜索并没有找到真正有效的结果。我发现 ZXing 可以生成不同的条形码。我写了一个小代码,我可以为 ean128 生成条形码。
package de..barcodee128;
import java.io.File;
import java.io.FileOutputStream;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.oned.Code128Writer;
import com.google.zxing.oned.Code39Writer;
import com.google.zxing.oned.OneDimensionalCodeWriter;
import com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder;
public class barcode128 {
public static void main(String[] args) {
int width = 440;
int height = 48;
BitMatrix bitMatrix;
try {
bitMatrix = new Code128Writer().encode("10400550006232515201231",BarcodeFormat.RSS_EXPANDED,width,height,null);
MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File("C:\\Users\\fecub\\Desktop\\zxing_barcode.png")));
} catch (WriterException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
但我的问题是如何修改此代码以使我能够创建 GS1 数据条扩展条码?任何想法??