les dejo mi codigo para quien pueda servirle:
Código Java:
Ver original
import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.awt.print.Book; import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterJob; import java.util.logging.Level; import java.util.logging.Logger; import net.sourceforge.barbecue.Barcode; import net.sourceforge.barbecue.BarcodeException; import net.sourceforge.barbecue.BarcodeFactory; import net.sourceforge.barbecue.BarcodeImageHandler; import net.sourceforge.barbecue.output.OutputException; public class JavaWorldPrintExample3 { JavaWorldPrintExample3 example3 = new JavaWorldPrintExample3(); } private final static int POINTS_PER_INCH = 72; public JavaWorldPrintExample3() { book.append(new IntroPage(), printJob.defaultPage()); printJob.setPageable(book); if (printJob.printDialog()) { try { printJob.print(); PrintException.printStackTrace(); } } } try { g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); g2d.draw(rec_item); g2d.draw(rec_q); g2d.draw(rec_l); g2d.draw(rec_c); Barcode barcode = BarcodeFactory.createCode39("N16U-24130-02", false); barcode.setDrawingText(false); barcode.setBarHeight(45); barcode.setBarWidth(1); ////// Barcode barcodeqty = BarcodeFactory.createCode39("Q50", false); barcodeqty.setDrawingText(false); barcodeqty.setBarHeight(42); barcodeqty.setBarWidth(1); /////////////// Barcode barcodelot = BarcodeFactory.createCode39("L0350", false); barcodelot.setDrawingText(false); barcodelot.setBarHeight(42); barcodelot.setBarWidth(1); /////////////// /////////////// g2d.setFont(countryFont); g2d.drawString(country, 51, 12); g2d.setFont(itemFont); g2d.drawString(item, 6, 24); g2d.setFont(nFont); g2d.drawString(n, 15, 33); g2d.setFont(itemnFont); g2d.drawString(itemn, 82, 32); g2d.drawImage(image, 18, 37, null); //////////////////// g2d.setFont(qualityFont); g2d.drawString(quality, 6, 93); g2d.setFont(qFont); g2d.drawString(q, 15, 102); g2d.setFont(qtyFont); g2d.drawString(qtyn, 115, 96); g2d.drawImage(imageqty, 86, 97, null); //////////////////// g2d.setFont(loteFont); g2d.drawString(lote, 6, 150); g2d.setFont(lFont); g2d.drawString(l, 12, 159); g2d.setFont(lotFont); g2d.drawString(lotn, 109, 152); g2d.drawImage(imagelot, 83, 153, null); //////////////////// g2d.setFont(cusFont); g2d.drawString(cus, 6, 204); g2d.setFont(cus_nFont); g2d.drawString(cust_n, 80, 209); g2d.setFont(country2Font); g2d.drawString(country2, 76, 225); //////////////////// } catch (OutputException ex) { Logger.getLogger(JavaWorldPrintExample3.class.getName()).log(Level.SEVERE, null, ex); } catch (BarcodeException ex) { Logger.getLogger(JavaWorldPrintExample3.class.getName()).log(Level.SEVERE, null, ex); }return PAGE_EXISTS; } } }