LiePoe Posted September 29, 2008 Share Posted September 29, 2008 We are trying to generate reports with EAN128 barcodes in them for a specific project. The barcode works and is readable if we only use 1 application identifier, but when we tried to create one with multiple AI's the barcode becomes illegible. Even more so: we end up with a barcode which starts with (01) which we do not want to have. We tested the same code with the barbecue library's generation tool and encountered the same problem. This is not acceptable behaviour at this moment. I've already posted a question on the barbecue's help forum, but haven't recieved an answer in more than a week.We have already looked for possible alternatives and one of them is Barcode4j, also a sourceforge project which is still active(whereas barbecue is dead). Barcode4j does support EAN128 fully(GS1 spec compliant) and also all the other formats that jasperreports supports. Is there a possibility to exchange the barbecue lib with the barcode4j one? Or can we edit the jrxml files so that it does generate a barcode4j file instead of the barbecue version?At this moment the barbecue library clearly does not provide accurate barcodes, and for a project such as jasperreports this should not be happening(in my opinion), since it brings down the quality of this excellent product. Is there a way to solve this? Maybe by supporting 2 barcode libraries instead of one or us providing a wrapper for barcode4J? Kind regards,Lieven PoelmanSr. IT EngineerSiemens Belgium Link to comment Share on other sites More sharing options...
lucianc Posted October 1, 2008 Share Posted October 1, 2008 JasperReports doesn't actually include a barcode element; iReport has a barcode widget that creates an image element which renders a barcode using Barbecue. There is also a JasperReports sample that shows how to include in a report a barcode rendered by Barbecue, but this doesn't mean that JasperReports has dedicated Barbecue support.If Barbecue is not a good solution in some cases, other barcode libraries can be leveraged in JasperReports in the same manner. Barcode4j can be used to draw report barcodes without any change to the JasperReports engine. You might have to write some code for that (probably an image renderer based on Barcode4j, and maybe some factory methods that would be used in image expressions), and you won't be able to use the iReport barcode widget to create such barcodes, but from the JasperReports point of view it would work in the same manner.We could also consider including barcode support in the JasperReports codebase, and if Barcode4j is the best barcode library candidate we would of course choose it over Barbecue. If you think that this would benefit JasperReports, please log it as a feature request here and it will be taken into consideration. In the meantime, you would need to use your own code to render Barcode4j images in reports.Regards,Lucian Link to comment Share on other sites More sharing options...
LiePoe Posted October 2, 2008 Author Share Posted October 2, 2008 Thank you for clarifying the situation. We had already found a way to implement it using ImageExpression(due to finding hints on the website of barcodelib.com). Link to comment Share on other sites More sharing options...
gerick Posted October 7, 2008 Share Posted October 7, 2008 luciancWrote: We could also consider including barcode support in the JasperReports codebase, and if Barcode4j is the best barcode library candidate we would of course choose it over Barbecue. If you think that this would benefit JasperReports, please log it as a feature request here and it will be taken into consideration. In the meantime, you would need to use your own code to render Barcode4j images in reports. Regards, Lucian LiePoeWrote: Thank you for clarifying the situation. We had already found a way to implement it using ImageExpression(due to finding hints on the website of barcodelib.com). I don't think that JasperReports needs to have barcode support included into it's codebase, as long as a solution is readily available as an outside barcode api. I was able to get BarcodeLib.com's api to work with their easy instructions because their api supports rendering a barcode as a JRRenderable object. BUT that is a commercial api. I would much rather be able to use an open source product such as Barcode4j but I haven't figured out how to implement their api.What is needed is a good step-by-step tutorial on using "the best barcode library candidate" and intergrating it with JasperReports. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted June 16, 2009 Share Posted June 16, 2009 Hi, JasperReports now comes with two production ready barcode components.One is for Barbecue and the other is for Barcode4J. They are part of the core library and are supported by iR NetBeans versions. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
dgarratt Posted June 23, 2009 Share Posted June 23, 2009 I've successfully integrated Barcode4j into my project with uses JasperReports. I've had to write some wrapper code which calls the barcode library as an external expression. The tricky bit was handling variable length fields like (37) and (10) where you need to tell barcode4j where the data ends. My wrapper function passes a reference to a XML file which barcode uses to read a template definition from. I've attached a sample barcode as a pdf. Dave Link to comment Share on other sites More sharing options...
pegami Posted July 2, 2009 Share Posted July 2, 2009 Could you please paste some example?. I need to compose an EAN 128 barcode with several application ID'S? Thaks Link to comment Share on other sites More sharing options...
lucianc Posted July 3, 2009 Share Posted July 3, 2009 pegamiWrote: Could you please paste some example?. I need to compose an EAN 128 barcode with several application ID'S? Thaks You can find samples in the JR 3.5.2 project distribution, see demo/samples/barbecue and demo/samples/barcode4j.Regards,Lucian Link to comment Share on other sites More sharing options...
dgarratt Posted July 3, 2009 Share Posted July 3, 2009 If you want to have a look at my source code you can download the project from http://www.commander4j.com The report is called "barcode" - it calls a method in my application code thus :-<imageExpression class="java.awt.Image"><![CDATA[com.commander4j.bar.JEANImage.getAWTImage("xml/barcode/label_bottom.xml","00"+$F{sscc})]]></imageExpression><imageExpression class="java.awt.Image"><![CDATA[com.commander4j.bar.JEANImage.getAWTImage("xml/barcode/label_top.xml", "02"+com.commander4j.util.JUtility.padString($F{ean},false,14,"0")+ "20"+com.commander4j.util.JUtility.padString($F{variant},false,2,"0")+ "17"+com.commander4j.util.JUtility.getTimeStampStringFormat($F{EXPIRY_DATE},"yymmdd")+ "37"+com.commander4j.util.JUtility.getFormattedQuantity($F{quantity}.toString(),4,"0")+ "10"+$F{batch_number})]]></imageExpression>The code above produces the 2 barcodes you see on the pdf in my previous post. The filenames in italics tell barcode4j how to interpret the data string.The second expression shown above contains the following application ID's(02)xxxxxxxxxxxxxx(20)xx(17)xxxxxx(37)xxxx(10)xxxxxxThe problem with this barcode is that application ID 37 is a variable length field according to the EAN spec, so I have to tell Barcode4j how long it is. This is done by passing my function the name of a barcode template file as a parameter, in this case xml/barcode/label_top.xml This file looks like this :- <?xml version="1.0"?><!DOCTYPE barcode SYSTEM "barcode4j.dtd"><barcode> <ean-128> <height>15mm</height> <module-width>0.3mm</module-width> <check-digit-marker>ð</check-digit-marker> <group-separator>ñ</group-separator> <template>(01)n14(20)n2(17)n6(37)n4(10)an1-20</template> <quiet-zone enabled="true">5mm</quiet-zone> <human-readable> <placement>bottom</placement> <font-name>Helvetica</font-name> <font-size>6pt</font-size> <omit-brackets>false</omit-brackets> </human-readable> </ean-128></barcode>Hope that helpsDave Link to comment Share on other sites More sharing options...
theism Posted May 30, 2011 Share Posted May 30, 2011 Hi LiePoe,how did you print EAN128/GS1 Barcodes with Barcode4J, we still have the same problems,missing FNC1 in Barcodes! :SBest regardsMichael Link to comment Share on other sites More sharing options...
cathyben3 Posted December 18, 2014 Share Posted December 18, 2014 I know this error with Barcode4J. So I've tested related java ean128 generator and finally found a resolution.Here's the reference for you:http://www.onbarcode.com/products/java_barcode/barcodes/ean_128.htmlhttp://www.onbarcode.com/jasper_reports/If you have any other good ideas. Please share with me as well. Thanks.Best regards. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now