// Creates new TicketPrinter public DevicePrinterESCPOS(PrinterWritter CommOutputPrinter, Codes codes, UnicodeTranslator trans) throws TicketPrinterException { m_sName = AppLocal.getIntString("Printer.Serial"); m_CommOutputPrinter = CommOutputPrinter; m_codes = codes; m_trans = trans; // Inicializamos la impresora m_CommOutputPrinter.init(ESCPOS.INIT); m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER); // A la impresora m_CommOutputPrinter.init(m_codes.getInitSequence()); m_CommOutputPrinter.write(m_trans.getCodeTable()); m_CommOutputPrinter.flush(); }
@Override public void printText(int iStyle, String sText) { m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER); if ((iStyle & DevicePrinter.STYLE_BOLD) != 0) { m_CommOutputPrinter.write(m_codes.getBoldSet()); } if ((iStyle & DevicePrinter.STYLE_UNDERLINE) != 0) { m_CommOutputPrinter.write(m_codes.getUnderlineSet()); } m_CommOutputPrinter.write(m_trans.transString(sText)); if ((iStyle & DevicePrinter.STYLE_UNDERLINE) != 0) { m_CommOutputPrinter.write(m_codes.getUnderlineReset()); } if ((iStyle & DevicePrinter.STYLE_BOLD) != 0) { m_CommOutputPrinter.write(m_codes.getBoldReset()); } }