@Override
  public void openDrawer() {

    m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER);
    m_CommOutputPrinter.write(m_codes.getOpenDrawer());
    m_CommOutputPrinter.flush();
  }
  // 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 endReceipt() {
   m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER);
   m_CommOutputPrinter.write(m_codes.getNewLine());
   m_CommOutputPrinter.write(m_codes.getNewLine());
   m_CommOutputPrinter.write(m_codes.getNewLine());
   m_CommOutputPrinter.write(m_codes.getNewLine());
   m_CommOutputPrinter.write(m_codes.getNewLine());
   m_CommOutputPrinter.write(m_codes.getCutReceipt());
   m_CommOutputPrinter.flush();
 }
  @Override
  public void beginLine(int iTextSize) {

    m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER);

    if (iTextSize == DevicePrinter.SIZE_0) {
      m_CommOutputPrinter.write(m_codes.getSize0());
    } else if (iTextSize == DevicePrinter.SIZE_1) {
      m_CommOutputPrinter.write(m_codes.getSize1());
    } else if (iTextSize == DevicePrinter.SIZE_2) {
      m_CommOutputPrinter.write(m_codes.getSize2());
    } else if (iTextSize == DevicePrinter.SIZE_3) {
      m_CommOutputPrinter.write(m_codes.getSize3());
    } else {
      m_CommOutputPrinter.write(m_codes.getSize0());
    }
  }
  @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());
    }
  }
  @Override
  public void printBarCode(String type, String position, String code) {

    m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER);
    m_codes.printBarcode(m_CommOutputPrinter, type, position, code);
  }
 @Override
 public void printLogo() {
   m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER);
   m_CommOutputPrinter.write(m_codes.getImageLogo());
 }
  @Override
  public void printImage(BufferedImage image) {

    m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER);
    m_CommOutputPrinter.write(m_codes.transImage(image));
  }
 @Override
 public void endLine() {
   m_CommOutputPrinter.write(ESCPOS.SELECT_PRINTER);
   m_CommOutputPrinter.write(m_codes.getNewLine());
 }