想要使用 java ee 应用程序和 ireport 和 barcode4j.jar 打印条码

Want to print barcode using java ee application and ireport and barcode4j.jar

我有一个 java EE 网络应用程序,我可以从中使用 barcode4j.jar 生成条形码,我将生成的 ByteArrayOutputStream 复制到一个映射变量,我是在 iReport (java.io.InputStream) 中使用相同的图像组件。

但是下载pdf的时候打印不出来。我只需要:

  1. 如何在 iReport 中映射生成的条形码。
  2. 我需要使用图像或条码组件吗?
  3. 如果我使用(barcode4j 的)条形码组件,我必须给出什么表达式。

请提供解决方案或一些有用的链接。

Earlier I thought we need to code in the application too to get the barcode printed but after my poc with help of another Whosebug post that it is only required to place the all the below  jars and add the barcode component in jrxm file is engough. Meaning below two were required to print(which is readable also) barcode .

1.add  below jars into lib.
avalon-framework-impl-4.2.0.jar
barcode4j-2.0.jar
batik-anim.jar
batik-awt-util.jar
batik-bridge.jar
batik-css.jar
batik-dom.jar
batik-ext.jar
batik-gvt.jar
batik-parser.jar
batik-script.jar
batik-svg-dom.jar
batik-util.jar
batik-xml.jar
commons-beanutils-1.8.2.jar
commons-cli-1.0.jar
commons-collections-3.2.1.jar
commons-digester-2.1.jar
commons-logging-1.1.jar
jdom-1.0.jar
saxon-9.1.0.8.jar
saxon8-dom.jar
servletapi-2.2.jar
xalan-2.7.0.jar
xercesImpl-2.9.1.jar
xml-apis-1.3.04.jar
xml-apis-ext.jar

2. Modify the jrxml. Add the barcode component (with barcode4j.jars). And add code Expression with your required field.