Generate GS1 databar expand Barcode in Java?

1.2k views Asked by At

I wan't to generate a Barcode which is type of GS1 databar expanded. I'm searched in google and didn't found realy working results. I discover that ZXing gives the possibility to generate different barcodes. I wrote an small code and i can generate barcode for ean128.

package de..barcodee128;
import java.io.File;
import java.io.FileOutputStream;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.oned.Code128Writer;
import com.google.zxing.oned.Code39Writer;
import com.google.zxing.oned.OneDimensionalCodeWriter;
import com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder;

public class barcode128 {
    public static void main(String[] args) {

           int width = 440; 
           int height = 48;


           BitMatrix bitMatrix;
        try {
            bitMatrix = new Code128Writer().encode("10400550006232515201231",BarcodeFormat.RSS_EXPANDED,width,height,null);
            MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File("C:\\Users\\fecub\\Desktop\\zxing_barcode.png")));
        } catch (WriterException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 

    }

}

But my question is how to modify this code that gives me to possibility to create GS1 databar expanded barcodes? any idea??

1

There are 1 answers

0
Sean Owen On BEST ANSWER

GS1 Databar Expanded is just the replacement name for what was the RSS Expanded symbology. These are read by the project, but not written, no.

(*) The RSS family of barcode symbologies were renamed to avoid clashing with the more common use of RSS as an acronym for Really Simple Syndication.