title: how can i change font size in thermal printing (lipi lwt 150) using C#.net
body: <p>I am using C#.net and GDI printing code to print to thermal printer LIPI LWT 150. But, I can't change my font size. I'm using Arial 9pt and 5pt, but it comes out in default size.
  Does anybody have any idea about this?</p>
  
  <p>I am using C# code like this:</p>
  
  <pre><code> public frmSale()
          {
              InitializeComponent();
              printingDoc.PrintPage += new PrintPageEventHandler(Form_PrintPage);
          }
  
  //initalizing print document
  private void PrintSettings()
  {
  
      printingDoc.DefaultPageSettings.Margins = new Margins(3, 3, 3, 3);
      PaperSize pSize = new PaperSize();
      pSize.Width = 275;
      printingDoc.DefaultPageSettings.PaperSize = pSize;
  
      // Claculating the PageWidth and the PageHeight
      PageHeight = printingDoc.DefaultPageSettings.PaperSize.Height;
      PageWidth = printingDoc.DefaultPageSettings.PaperSize.Width;
      // Claculating the page margins
      LeftMargin = printingDoc.DefaultPageSettings.Margins.Left;
      TopMargin = printingDoc.DefaultPageSettings.Margins.Top;
      RightMargin = printingDoc.DefaultPageSettings.Margins.Right;
      BottomMargin = printingDoc.DefaultPageSettings.Margins.Bottom;
      printAreaWidth = PageWidth - RightMargin - LeftMargin;
  
  }
  
  private void Form_PrintPage(object o, PrintPageEventArgs e)
  //Here we Begin All the printing Process... 
  {
  
         PrintSettings();
         CurrentY = (float)printingDoc.DefaultPageSettings.Margins.Top;//0;
         PrintEstHeader(e.Graphics);
          DrawEstGridData(e);
  
  }
  
  //Printing Function
  private void PrintEstData(Graphics g, string stringData, StringAlignment alignment, Font fnt, Color clr, bool newLine)//,int starting,int maxWidth)
  {
      StringFormat stringFormat = new StringFormat();
      stringFormat.Trimming = StringTrimming.Word;
      stringFormat.FormatFlags = StringFormatFlags.NoWrap |
          StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
  
      stringFormat.Alignment = alignment;
  
      RectangleF Rect = new RectangleF((float)LeftMargin, CurrentY,
                        (float)PageWidth - (float)RightMargin - (float)LeftMargin,
                        g.MeasureString(stringData, fnt).Height);
  
      g.DrawString(stringData, fnt,
         new SolidBrush(clr),
         Rect, stringFormat);
  
      CurrentY += newLine ? g.MeasureString(stringData, fnt).Height : 0;
   }
  
  private void PrintEstHeader(Graphics g)
  {
  
      PrintEstData(g, "----------------------------------------------", StringAlignment.Near, new Font("Arial", 9), Color.Black, true);//,LeftMargin,printAreaWidth);
  
      PrintEstData(g, "Estimate" + "    " + "Rate  :" + ncRate.Value.ToString("0.00"), StringAlignment.Near, new Font("Arial", 9, FontStyle.Bold), Color.Black, true);//, LeftMargin, 76);
  
      PrintEstData(g, "----------------------------------------------", StringAlignment.Near, new Font("Arial", 9), Color.Black, true);//, LeftMargin, printAreaWidth);
      PrintEstData(g,"|ITEM |"+"WEIGHT|"+ "STN WT|"+"M.C. %|"+"Total|", StringAlignment.Near, new Font("Arial", 5), Color.Black, true);//,LeftMargin,42);
      PrintEstData(g, "----------------------------------------------", StringAlignment.Near, new Font("Arial", 9), Color.Black, true);//, LeftMargin, printAreaWidth);
  }
  </code></pre>