title: How to change text size to print on thermal printer
body: <p>I have a java applicato that use the thermal print to printer a text. I use this printer to print the order for the bar.
  This is an example of the ticket:</p>
  
  <pre><code> --&gt; BAR
  Coca Cola  1 x 1.5
  Fanta      1 x 1.5
  -------------------
  TOTALE     3.00 euro
  </code></pre>
  
  <p>And the code to print this ticket works.
  But I wanto to change the font size because the font is to small. How can I change the font ??</p>
  
  <p>This is the code that I use to create and printer a ticket:</p>
  
  <pre><code>PrinterBean localPrinterBean = null;
  StringBuffer localStringBuffer = null;
  HashMap localHashMap=null;
  if(emettiScontrinoCartaceo){
      //PER LA STAMPA SCOTRNIO
      localPrinterBean = getPrinterBean();
      localStringBuffer = new StringBuffer();
      localHashMap = null;
      if ((localPrinterBean.isPrn_Enabled()) &amp;&amp; (!localPrinterBean.isPrn_Onlyticket()))
      {
          //log.info("" + localPrinterBean.getPrn_driver());
          localHashMap = PrinterManager.loadEscDriver(localPrinterBean);
          //localStringBuffer.append("\n");
          localStringBuffer.append(String.format("\t%s-&gt;&gt; %s%s\n", new Object[] { localHashMap.get("size2w"), "BAR", localHashMap.get("size2w-off") }));
          localStringBuffer.append("\n");
      }
      //FINE STAMPA SCOTNRINO     
  }
  
  while (it.hasNext()) {
      Map.Entry entry = (Map.Entry)it.next();
      ArticoliScontrini artSco = (ArticoliScontrini) (entry.getValue());
      //devo inserire nella lista le righe di stampa dello scontrino
      //INIZIO STAMPA SCONTRINO
      localStringBuffer.append(String.format("%s\n", new Object[] { artSco.getDescrizioneArticolo() }));
      String quantita = artSco.getQuantita() + " x " +artSco.getPrezzoTotStringFormattato();//toString(artSco.getQuantita(), true);
      localStringBuffer.append(String.format("\t %s", new Object[] { quantita }));
      localStringBuffer.append("\n");
      //FINE STAMPA SCONTRINO
  
  }
  localStringBuffer.append("------------------------------------------");
  localStringBuffer.append("\n");
  String totale = "TOTALE " + decimalFormatter2.format(totaleScontrinoCartaceo) + " euro";
  localStringBuffer.append(String.format("%s\n", new Object[] { totale }));
  
  String str = localStringBuffer.toString();
  try{
      cbPrintBuffer(localPrinterBean);    
  }
  catch(Exception e){
      VisualMessageScontrini.getErroreStampaScontrino();
  }
  
  
  
  public void cbPrintBuffer(PrinterBean paramPrinterBean)
      throws Exception
    {
      /*Object localObject1 = JabirCfg.hexItIfn(paramPrinterBean.getPrn_Hexinit());
      if ((localObject1 != null) &amp;&amp; (!((String)localObject1).equals(""))) {
        printRawBytes(paramPrinterBean, ((String)localObject1).getBytes());
      }*/
      Object localObject1 = null;
      if (paramPrinterBean.hasPrn_Bitopt(2))
      {
        localObject1 = new FileOutputStream(paramPrinterBean.getPrn_driver());
        ((FileOutputStream)localObject1).write(cbGetFlow());
        ((FileOutputStream)localObject1).close();
        return;
      }
      localObject1 = PrinterManager.getPrintService_cached(paramPrinterBean);
      if (paramPrinterBean.isPrnGd())
      {
        boolean bool = paramPrinterBean.hasPrn_Bitopt(32);
        PrinterJob localObject2 = PrinterJob.getPrinterJob();
        ((PrinterJob)localObject2).setPrintService((PrintService)localObject1);
        ((PrinterJob)localObject2).setJobName("easy ticket");
        PageFormat localPageFormat = ((PrinterJob)localObject2).defaultPage();
        PrinterExtra.deserialize_pagejson_to_PageFormat(paramPrinterBean.getPrn_pagejson(), localPageFormat);
        Printable localPrintable = null;
        for (int i = 0;; i++)
        {
          if (bool) {
            localPrintable = cbPrintable(i);
          } else {
            localPrintable = cbPrintable(-1);
          }
          if (localPrintable == null) {
            break;
          }
          ((PrinterJob)localObject2).setPrintable(localPrintable, ((PrinterJob)localObject2).validatePage(localPageFormat));
          ((PrinterJob)localObject2).print();
          if (!bool) {
            break;
          }
          String str = JabirCfg.hexItIfn("0x1b 0x6d");
          printRawBytes(paramPrinterBean, str.getBytes());
        }
        return;
      }
      DocPrintJob localDocPrintJob = ((PrintService)localObject1).createPrintJob();
      Object localObject2 = new SimpleDoc(cbGetFlow(), DocFlavor.BYTE_ARRAY.AUTOSENSE, null);
      localDocPrintJob.print((Doc)localObject2, new HashPrintRequestAttributeSet());
    }
  </code></pre>