Post by David ShereI need to print bar codes with ofbiz. Can someone point me in the right
direction? Is there an ofbiz consulting company that might be able to
help me? I need to know objects to use, services to call, etc. It
seems likely that someone has done this already with ofbiz.
What I had asked David about was a means to print barcodes on barcode
printers using native Zebra EPL/2 control codes to a named print spool,
not printing a barcode on a pdf.
||||||||
Simple samples of what gets transmitted.
https://support.zebra.com/cpws/docs/eltron/common/epl2_samp.htm
||||||||
Here is a working code to print to Zebra printer that I found on a website.
<quote>
Printer name should contain keyword "zebra", printer could be local or on network.
public void testZebra() {
try {
PrintService psZebra = null;
String sPrinterName = null;
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
for (int i = 0; i < services.length; i++) {
PrintServiceAttribute attr = services.getAttribute(PrinterName.class);
sPrinterName = ((PrinterName)attr).getValue();
if (sPrinterName.toLowerCase().indexOf("zebra") >= 0) {
psZebra = services;
break;
}
}
if (psZebra == null) {
System.out.println("Zebra printer is not found.");
return;
}
System.out.println("Found printer: " + sPrinterName);
DocPrintJob job = psZebra.createPrintJob();
//String s = "^XA^FO5,40^BY3^B3,,30^FD123ABC^XZ"; // good
String s = "^XA\n^FO5,40^BY3^B3,,\n30^FD123ABC\n^XZ"; // '\n' does not hurt
byte[] by = s.getBytes();
DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
// MIME type = "application/octet-stream",
// print data representation class name = "[B" (byte array).
Doc doc = new SimpleDoc(by, flavor, null);
job.print(doc, null);
} catch (PrintException e) {
e.printStackTrace();
}
} // testZebra()
</quote>
||||||||
Does any of this ring a bell to anyone?
Done anything like this in the past?
Could any of this be used with ofBiz?
--
Walter