From: Jeremias M. <de...@je...> - 2010-08-20 06:55:43
|
On 20.08.2010 00:12:53 Kalyanaraman, Kalyan (Dallas) wrote: > Appreciate your help. I was under the impression that it will > re-calculate while generating the barcode. Not sure what you mean. > If we can add an optional > validation flag to validate the configuration before generation, that > will be cool. I had some minor challenges where the barcode would scan > in some scan guns and not in others, reducing the wide factor fixed > that issue. I think these ranges I found in various specs are often recommendations and rarely hard limits. OTOH, not every scanner will easily scan every barcode even if it's within a "safe" margin. Furthermore, people can generate vector graphics versions of the barcodes and scale them later (not under the control of Barcode4J) which can have an influence on the readability. Even printing optimal bitmap barcodes may not always result in satisfactory output if done wrong. Then we still have to look at the printers and how they manage to bring the symbols to paper. All in all, there are so many influencing factors which can stand in the way of successfully scanning a barcode. At any rate, your idea is certainly not a bad one but it won't always fix the problem. I'll keep it in the back of my head. Obviously, good patches are always appreciated and I'm happy to look at them as time allows (poke me if I let it lie around too long. I'm usually quite busy). > Overall, this is a great piece of software when compared to using > the embedded object font generated by Microsoft WEFT. Good to hear. > > > -----Original Message----- > From: Jeremias Maerki [mailto:de...@je...] > Sent: Tuesday, August 17, 2010 1:02 AM > To: bar...@li... > Subject: Re: [Barcode4j-users] Help!! setting width and height for a Code39Bean > > Hi Kalyan > > The most likely problem is that you're using bean.setModuleWidth() > twice: > 1. bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); > 2. bean.setModuleWidth(.05); > > So this overrides what you've set in the first step. > > 0.05mm are below the 0.19mm that are required by many Code39 specs I've > found. See: http://barcode4j.sourceforge.net/2.0/symbol-code39.html > > UnitConv.in2mm(1.0f / 150) = 0.169333 > > That's also a bit under the recommendation. If you lower the resolution > for the barcode bitmap to 120 dpi, you get a module width of 0.21mm. But > for this to work in print, you still have to make sure the barcode > bitmap is painted at 100% zoom (i.e. in its natural size). Otherwise the > bars get scaled up or down again which may result in scanning problems. > > HTH > > On 16.08.2010 23:23:03 Kalyanaraman, Kalyan (Dallas) wrote: > > I am trying to generate code39 barcodes using barcode4j. When I resize > > the barcode using setModuleWidth and setBarHeight method, the generated > > barcode is not scannable from scan gun. Please let me where iam going > > wrong. > > > > Thanks a lot! > > Kalyan > > > > > > > > int orientation = 0; > > this.dpi = 150; > > Code39Bean bean = new Code39Bean(); > > bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); //makes the narrow bar > > //width exactly one pixel > > bean.setWideFactor(3); > > bean.setMsgPosition(HumanReadablePlacement.HRP_NONE); > > bean.setBarHeight(5); > > bean.setDisplayStartStop(true); > > bean.setModuleWidth(.05); > > bean.doQuietZone(false); > > //orientation = setDimensions(request, bean); > > BitmapCanvasProvider canvas = new BitmapCanvasProvider( > > baout, "image/png", dpi, > > BufferedImage.TYPE_BYTE_BINARY, false, orientation); > > try { > > bean.generateBarcode(canvas, barcode); > > canvas.finish(); > > //testSaveFile(((ByteArrayOutputStream) baout).toByteArray(), "writeFileTest"+barcode); > > } finally { > > baout.close(); > > } > > > > Jeremias Maerki |