Java Print Barcode Labels

Can anyone point out the right direction for printing barcode labels using Java? I can use the barbecue library ( http://barbecue.sourceforge.net/ ) to generate their barcodes as images, but I need a way to put the image (and a human readable signature) into an Avery printable document template.

+2


source to share


6 answers


The iText library supports almost any kind of barcode. You can create PDF files and save them or print them internally.



+3


source


I suggest using the barcode4j library instead of barbecue for two reasons:

  • BBQ barcode objects are not necessarily associated with Java UI components (for example, the barcode class extends JComponent). This creates unnecessary dependencies if no Java UI is used, eg. for batch or command line based applications. They had to use aggregation rather than inheritance if they wanted to use their barcode classes with a Java interface.

  • Barcode4J looks like it is currently supported - version 2.0 released and copyright date 2012.



Then you have the problem of translating the barcode into a format that your printer understands. For this I suggest openlabelprint.org (which I wrote!) Is another open source project that uses barcode4j and provides:

  • means for defining the layout of the label using SVG (scalable vector graphics - open standard w3c) and

  • rasterize to SVG bitmap from barcode4j (and label layout in SVG) (openlabelprint uses the excellent Apache SVG Batik Java libraries for rasterization as well as other SVG tasks)

  • Print bitmap to Zebra printers using their ZPL low level language. openlabelprint has a built-in utility to convert png raster images to ZPL and send them to a Zebra printer via the standard Java printer system. In addition, openlabelprint provides APIs to extend it to other printer languages, although ZPL is supported by some non-Zebra brands.

+3


source


I am printing barcodes using java, but I am using a printer that has a programmed function to print barcodes. So I'm only talking about the printer, what codes are printed, and everything else. If you're willing to pay for a printer, it could save you some time.

This may or may not be helpful to you, but I thought I mentioned it.

+2


source


I think you will need to measure your Avery tagged page with a ruler and then in your Java code, you will need to create a full Letter / A4 / any page to print and offset your barcode image on that page with the corresponding location based on your measurements with a ruler.

+1


source


Have you tried printing the image you got from the BBQ?

0


source


You should try JZebra, it is an applet and a good starting point for you, have a look at the java source code.

http://code.google.com/p/jzebra/

For a zebra, this simple guide will help you. On this Zebra team

N
q609
Q203,26
B26,26,0,UA0,2,2,152,B,"777777"
A253,56,0,3,1,1,N,"JHON3:16"
A253,26,0,3,1,1,N,"JESUSLOVESYOU"
A253,86,0,3,1,1,N,"TEST TEST TEST"
A253,116,0,3,1,1,N,"ANOTHER TEST"
A253,146,0,3,1,1,N,"SOME LETTERS"
P1,1

      

on JZebra

     var applet = document.jzebra;
     if (applet != null) {
applet.append("N\n");
applet.append("q609\n");
applet.append("Q203,26\n");
 applet.append("B26,26,0,UA0,2,2,152,B,\"777777\"\n");
applet.append("A253,56,0,3,1,1,N,\"JHON3:16\"\n");
applet.append("A253,26,0,3,1,1,N,\"JESUSLOVESYOU\"\n");
applet.append("A253,86,0,3,1,1,N,\"TEST TEST TEST\"\n");
applet.append("A253,116,0,3,1,1,N,\"ANOTHER TEST\"\n");
applet.append("A253,146,0,3,1,1,N,\"SOME LETTERS\"\n");
applet.append("P1,1\n");}

      

Clearing this:

EPL is one command per line. A command is run with a command identifier, usually a letter, followed by a list of parameters specific to that command. You can review each of these commands in the EPL2 programming documentation. Here is the English version of the commands in the above example.

  • Sending the first newline ensures that any previous borked command has been sent.
  • [N] Clear the image buffer. This is an important step and should usually be the first command in any EPL document; who knows what state the previous job left the printer in.
  • [q] Set the mark width to 609 dots (3 inch mark x 203 dpi = 609 dots wide).
  • [Q] Set the height of the lettering to 203 dots (1-inch mark) with 26 between the marks. (The printer might auto-sense, but it won't hurt.)
  • [B] Draw a UPC-A barcode with the value "777777" at x = 26 dots (1/8 "), y = 26 dots (1/8") with a narrow strip 2 dots wide and 152 dots high (3 / 4 inches). (The origin of the label coordinate system is the upper left corner of the label.)
  • [A] Draw the text "JESUSLOVESYOU" at x = 253 dots (3/4 "), y = 26 dots (1/8") in printer font "3", normal horizontal and vertical scaling, and no fancy "white on black. "

All starting lines are the same. 10. [P] Prints one copy of one mark.

0


source







All Articles