Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Java
public 
class imagetotext1 {

    public static void main(String[] args) throws Exception
        {
            BarcodeEAN codeEAN = new BarcodeEAN();
            codeEAN.setCodeType(Barcode.EAN8);
            codeEAN.setCode("4902555131719");
            Image image = codeEAN.createAwtImage(Color.black, Color.white);
            BufferedImage.TYPE_3BYTE_BGR);
            BufferedImage bffImg1=ImageIO.read(new File("D:\\testing\\p99.png"));
            Graphics offg = bffImg1.createGraphics();
            offg.drawImage(image,0,170, null);
            ImageIO.write(bffImg1, "jpeg", new File("test.jpg"));
        }
}


in above code i can create bar code .
what can i do for reading bar code??
Posted
Updated 15-Oct-13 3:48am
v3
Comments
Richard MacCutchan 15-Oct-13 9:49am    
You will need a barcode reader attached to your system.
Sergey Alexandrovich Kryukov 15-Oct-13 11:25am    
It's pointless to brink here some codes written by who-knows-who, not yours. You can download any kind of trash on the Web, why should we look at it? Write your own code, explain its purpose and problems you faced with, then we will gladly help you.
—SA
baliram bhande 16-Oct-13 1:47am    
sorry sir............

1 solution

It all depends on the library where you get your code from:

Here below is from Maven:

http://grepcode.com/file/repo1.maven.org/maven2/com.lowagie/itext/2.0.1/com/lowagie/text/pdf/BarcodeEAN.java

Similar to your code above, it has "setCode()" API (see the left frame windows and click on it) to allow you to input the numbers to be converted to images.

And it also has "getCode()" which allow you to do vice versa.

Look up your library API for details.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900