John Williams
unread,Jul 24, 2013, 10:08:49 PM7/24/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to zx...@googlegroups.com
I'm new to Zxing and I am attempting to generate barcodes using Zing. However I unable to find any javadocs for Zxing and am having trouble displaying the barcode number on the image. Here is the code that I am using. The value is encoded and can be read, however I need the encoded value added to the image.
package barcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Writer;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.ByteMatrix;
import com.google.zxing.oned.Code128Writer;
import com.google.zxing.pdf417.encoder.PDF417Writer;
import com.google.zxing.qrcode.QRCodeWriter;
import java.io.File;
import java.io.FileOutputStream;
public class Barcode {
public static void main(String[] args) {
BitMatrix bitMatrix;
Writer writer = new QRCodeWriter();
FileOutputStream fop = null;
File file;
try {
// Write Barcode
bitMatrix = new Code128Writer().encode("123456789", BarcodeFormat.CODE_128, 150, 80, null);
MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File("C://code128_123456789.png")));
System.out.println("Code128 Barcode Generated.");
} catch (Exception e) {
System.out.println("Exception Found." + e.getMessage());
}
}
}
} catch (Exception e) {
System.out.println("Exception Found." + e.getMessage());
}
}
}
Regards