By Date: <-- -->
By Thread: <-- -->

created barcodes accuracy



Having looked at various sites that do barcodes and from using createAwtImage with iText it would seem to me that iText produces bar codes that are not the same as other bar code generators.

I am trying to create a barcode using code 128. Here is the code that I’m using.

 

            java.awt.Image barImage = null;

BaseFont   font       = null;

Barcode128 bar128      = new Barcode128();

            try {

                        font = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, true);

            }

            catch(Exception e) {

                        e.printStackTrace();

            }

                                      

            bar128.setFont(font);

            bar128.setCode(barcode);

             

            //generate the bar code

            barImage = bar128.createAwtImage(Color.black, Color.white);

 

I am then displaying that image on a web page as it is, its not getting scaled or reduced, but when I compare the returned image with other sites that generate them for you to see, the two barcodes do not match up.

I need to verify that the iText program is creating the images correctly. I also have to use the createAwtImage function as I need a java image.

Has anyone any ideas. If iText can’t do java images properly can anyone recommend other software that can generate jpg or png images that I can use in java.

Thanks Kenneth.