title: MICR symbols rendering small on output device after migrated to Windows server 2016 from WIndows server 2008 on VB.net code
body: <p>The Code had been worked on Windows 2008 server but we migrated to windows 2016 server then the symbols producing small on out device.we have hardcoded MICR symbols in the program and I tried different font style, previously we had &quot;Arial MS Unicode&quot; later changed to &quot;Courier New&quot; nothing worked to produce correct symbols. could you please check and help me to sort out the issue?</p>
  <p>Function convertFrontIRD(chkImgBytes() As Byte) As Image
  Dim irdWidth As Integer, irdHeight As Integer, fontSize As Integer, micrFontSize As Integer, micrChrFontSize As Integer, irdtxtFontSize As Integer</p>
  <pre><code>    fontSize = 10
      micrFontSize = 10
      micrChrFontSize = micrFontSize + 2
      irdtxtFontSize = fontSize - 1
  
      irdWidth = 8.5 * ppi      ' ( Assuming Letter paper size, 8.5 inch X 300 pixes/inch PPI)
      irdHeight = CInt((11 / 3) * ppi)    ' ( Assuming Letter paper size, 11 inch X 300 pixes/inch PPI) and each page would have 3 IRD pages
      Dim irdImg = New Bitmap(irdWidth, irdHeight)
      irdImg.SetResolution(ppi, ppi)
      Dim irdGraphics = Graphics.FromImage(irdImg)
      irdGraphics.Clear(Color.White)
  
      Dim strText As String, stringSize As New SizeF, strFont As Font, textFormat As New System.Drawing.StringFormat
      Dim yGap As Int16, xGap As Int16
  
      yGap = 2 : xGap = 5
  
      Dim lbWidth As Integer, lbHeight As Integer, boxX As Integer, boxY As Integer, boxX1 As Integer, boxY1 As Integer
  
      ''''       Left Window        
      lbWidth = 1.88 * ppi : lbHeight = 2.85 * ppi : boxX = 0 : boxY = 10 * yGap : boxX1 = lbWidth : boxY1 = 0
      strFont = New Font(&quot;OCR-A Hanna&quot;, fontSize)
      textFormat.Alignment = StringAlignment.Center
      textFormat.LineAlignment = StringAlignment.Center
  
      'Bank RT
      strText = &quot;*&quot; &amp; bankRt &amp; &quot;*&quot;
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxY1 = boxY + stringSize.Height
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
      'Business Date
      strText = Format(Today, &quot;MM/dd/yyyy&quot;)
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxY = boxY1 + yGap
      boxY1 = boxY + stringSize.Height
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
      'Application seq Number
      strText = aeSeq
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxY = boxY1 + yGap
      boxY1 = boxY + stringSize.Height
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
      'IRD Text
      strFont = New Font(&quot;Courier New&quot;, irdtxtFontSize)
      textFormat.Alignment = StringAlignment.Near
      textFormat.LineAlignment = StringAlignment.Near
  
      strText = &quot;This is a LEGAL COPY of your&quot;
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxY = boxY1 + 2 * stringSize.Height
      boxY1 = boxY + stringSize.Height
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
  
      'IRD Text
      strText = &quot;check. You can use it the same&quot;
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxY = boxY1 + yGap
      boxY1 = boxY + stringSize.Height
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
      'IRD Text
      strText = &quot;way you would use the original&quot;
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxY = boxY1 + yGap
      boxY1 = boxY + stringSize.Height
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
      'IRD Text
      strText = &quot;check.&quot;
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxY = boxY1 + yGap
      boxY1 = boxY + stringSize.Height
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
      strFont = New Font(&quot;OCR-A Hanna&quot;, fontSize)
      textFormat.Alignment = StringAlignment.Near
      textFormat.LineAlignment = StringAlignment.Near
  
      If Trim(resCode) &lt;&gt; &quot;&quot; Then
          strText = &quot;RETURN REASON - &quot; &amp; resCode
          stringSize = irdGraphics.MeasureString(strText, strFont)
          boxY = boxY1 + 2 * stringSize.Height
          boxY1 = boxY + stringSize.Height
          irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
  
          If Trim(resDesc) &lt;&gt; &quot;&quot; Then
              strText = resDesc
              stringSize = irdGraphics.MeasureString(strText, strFont)
              boxY = boxY1 + yGap
              boxY1 = boxY + stringSize.Height
              irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
          End If
      End If
  
  
      ' Middle Vertical Text        
      Dim mbWidth As Integer, mbHeight As Integer
      mbHeight = 0.37 * ppi : mbWidth = 2.6 * ppi : boxX = lbWidth + xGap : boxY = yGap : boxX1 = boxX + mbHeight : boxY1 = boxY + mbWidth
      strFont = New Font(&quot;OCR-A Hanna &quot;, fontSize)
      textFormat.Alignment = StringAlignment.Center
      textFormat.LineAlignment = StringAlignment.Center
  
      strText = &quot;[&quot; &amp; bankRt &amp; &quot;] &quot; &amp; depDate &amp; vbNewLine &amp; hsSeq
      stringSize = irdGraphics.MeasureString(strText, strFont)
      'textFormat.FormatFlags = StringFormatFlags.DirectionVertical
      irdGraphics.TranslateTransform(boxX1, boxY1)
      irdGraphics.RotateTransform(-90)
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX / 1.5, -stringSize.Height / 2, 0, 0), textFormat)
      irdGraphics.ResetTransform()
  
  
      'Top Text
      Dim tWidth As Integer, tHeight As Integer
      tWidth = 5 * ppi : tHeight = 0.33 * ppi
      If Trim(resDesc) &lt;&gt; &quot;&quot; Then
          boxX = lbWidth + xGap + mbHeight + xGap : boxY = yGap : boxX1 = boxX + tWidth : boxY1 = tHeight
          textFormat.Alignment = StringAlignment.Near
          textFormat.LineAlignment = StringAlignment.Near
          irdGraphics.DrawString(resDesc, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1), textFormat)
      End If
  
      ' Check Image
      Dim chkImage As Image
      Dim cImgWidth As Integer, cImgHeight As Integer
      cImgWidth = 5.75 * ppi : cImgHeight = 2.42 * ppi : boxX = lbWidth + xGap + mbHeight + xGap : boxY = tHeight + yGap : boxX1 = boxX + cImgWidth : boxY1 = boxY + cImgHeight
      chkImage = Bitmap.FromStream(New IO.MemoryStream(chkImgBytes))
  
      If (chkImage.Width / chkImage.Height) * cImgHeight &lt; cImgWidth Then cImgWidth = (chkImage.Width / chkImage.Height) * cImgHeight
      irdGraphics.DrawImage(chkImage, boxX, boxY, cImgWidth, cImgHeight)
      'irdGraphics.DrawImage(chkImage, New Rectangle(boxX, boxY, boxX1, boxY1))
  
      'Bottom Text        
      Dim bbWidth As Integer, bbHeight As Integer, adjMeasure As Int16
      'bbWidth = irdWidth : bbHeight = irdHeight - (tHeight + cImgHeight + (0.5 * ppi)) : boxX = 0 : boxY = tHeight + cImgHeight + (0.6 * ppi) : boxX1 = bbWidth - (0.375 * ppi) : boxY1 = boxY + bbHeight
      bbWidth = irdWidth : bbHeight = 0.5 * ppi : boxX = 0 : boxY = tHeight + cImgHeight + (0.45 * ppi) : boxX1 = bbWidth - (0.375 * ppi) : boxY1 = boxY + bbHeight
  
      adjMeasure = 10
      strFont = New Font(&quot;Courier New&quot;, micrChrFontSize, FontStyle.Bold)
      strText = &quot;⑇&quot;    '  Check Amount
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
      strFont = New Font(&quot;MICR&quot;, micrFontSize, FontStyle.Bold)
      strText = CLng(cAmt).ToString(&quot;0000000000&quot;)     '  Check Amount
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxX1 = boxX + 2 * xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
  
      strFont = New Font(&quot;Courier New&quot;, micrChrFontSize, FontStyle.Bold)
      strText = &quot;  ⑇&quot;    ' Check Amount
      stringSize = irdGraphics.MeasureString(&quot;00&quot;, strFont)
      boxX1 = boxX + 2 * xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
      ' Tran Code
      If CTranCode &lt;&gt; &quot;&quot; And cSerial = &quot;&quot; Then
          'strFont = New Font(&quot;Courier New&quot;, micrChrFontSize)
          'strText = &quot;⑈&quot; 'Check TranCode        
          'stringSize = irdGraphics.MeasureString(strText, strFont)
          'boxX1 = boxX + 2 * xGap
          'boxX = boxX1 - stringSize.Width
          'irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
          strFont = New Font(&quot;MICR&quot;, micrFontSize, FontStyle.Bold)
          strText = CTranCode 'Check TranCode        
          stringSize = irdGraphics.MeasureString(&quot;0000&quot;, strFont)
          boxX1 = boxX + 2 * xGap
          boxX = boxX1 - stringSize.Width
          irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
  
          'strFont = New Font(&quot;Courier New&quot;, micrChrFontSize)
          'strText = &quot;⑈&quot; 'Check TranCode        
          'stringSize = irdGraphics.MeasureString(strText, strFont)
          'boxX1 = boxX + 2 * xGap
          'boxX = boxX1 - stringSize.Width
          'irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
      Else
          strText = &quot;0000&quot;
          stringSize = irdGraphics.MeasureString(strText, strFont)
          boxX1 = boxX + 2 * xGap
          boxX = boxX1 - stringSize.Width
          strText = &quot;        &quot;
          irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
  
      End If
  
      strFont = New Font(&quot;Courier New&quot;, micrChrFontSize, FontStyle.Bold)
      strText = &quot;⑈&quot; ' Check Account
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxX1 = boxX + 2 * xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
      strFont = New Font(&quot;MICR&quot;, micrFontSize, FontStyle.Bold)
      strText = cAccount.PadLeft((14 - cAccount.Length) * 3 + cAccount.Length)  ' Check Account Left Justinfied
      stringSize = irdGraphics.MeasureString(&quot;00000000000000&quot;, strFont)
      'textFormat.Alignment = StringAlignment.Near
      'textFormat.LineAlignment = StringAlignment.Near
      boxX1 = boxX + 2 * xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
  
      strFont = New Font(&quot;Courier New&quot;, micrChrFontSize, FontStyle.Bold)
      strText = &quot;⑆&quot;           'Check RT        
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxX1 = boxX + 2 * xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
      strFont = New Font(&quot;MICR&quot;, micrFontSize, FontStyle.Bold)
      strText = cRT           'Check RT        
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxX1 = boxX + 2 * xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
  
      strFont = New Font(&quot;Courier New&quot;, micrChrFontSize, FontStyle.Bold)
      strText = &quot;⑆&quot;          'Check RT        
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxX1 = boxX + 2 * xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
      strFont = New Font(&quot;MICR&quot;, micrFontSize, FontStyle.Bold)
      strText = &quot;    4 &quot;           'Check RT        
      stringSize = irdGraphics.MeasureString(strText, strFont)
      boxX1 = boxX + xGap
      boxX = boxX1 - stringSize.Width
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
  
      If cSerial &lt;&gt; &quot;&quot; Then
          strFont = New Font(&quot;Courier New&quot;, micrChrFontSize, FontStyle.Bold)
          strText = &quot;⑈&quot;          'Check Serial     
          stringSize = irdGraphics.MeasureString(strText, strFont)
          boxX1 = boxX + xGap
          boxX = boxX1 - stringSize.Width
          irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
          strFont = New Font(&quot;MICR&quot;, micrFontSize, FontStyle.Bold)
          strText = cSerial        'Check Serial     
          stringSize = irdGraphics.MeasureString(strText, strFont)
          boxX1 = boxX + xGap
          boxX = boxX1 - stringSize.Width
          irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
  
          strFont = New Font(&quot;Courier New&quot;, micrChrFontSize, FontStyle.Bold)
          strText = &quot;⑈&quot;           'Check Serial     
          stringSize = irdGraphics.MeasureString(strText, strFont)
          boxX1 = boxX + 2 * xGap
          boxX = boxX1 - stringSize.Width
          irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY - adjMeasure, boxX1, boxY1))
  
      End If
  
      Return irdImg
  
  End Function
  
  'Create Rear IRD from check Rear image
  Function convertRearIRD(chkImgBytes() As Byte) As Image
      Dim irdWidth As Integer, irdHeight As Integer, fontSize As Integer
  
      'Font sizes        
      fontSize = 9
  
      'Paper Sizes
      irdWidth = 8.5 * ppi      ' ( Assuming Letter paper size, 8.5 inch X 300 pixes/inch PPI)
      irdHeight = (11 / 3) * ppi    ' ( Assuming Letter paper size, 11 inch X 300 pixes/inch PPI) and each page would have 3 IRD pages
      Dim irdImg = New Bitmap(irdWidth, irdHeight)
      irdImg.SetResolution(ppi, ppi)
      Dim irdGraphics = Graphics.FromImage(irdImg)
      irdGraphics.Clear(Color.White)
  
      Dim strText As String, stringSize As New SizeF, strFont As Font, textFormat As New System.Drawing.StringFormat
      Dim chkImage As Image, cImgWidth As Integer, cImgHeight As Integer, boxX As Integer, boxY As Integer, boxX1 As Integer, boxY1 As Integer
  
      ''''       Rear Image                      
      cImgWidth = 5.75 * ppi : cImgHeight = 2.4 * ppi : boxX = 0 : boxY = 0.35 * ppi : boxX1 = cImgWidth : boxY1 = 0
      chkImage = Bitmap.FromStream(New IO.MemoryStream(chkImgBytes))
      If (chkImage.Width / chkImage.Height) * cImgHeight &gt; cImgWidth Then cImgWidth = (chkImage.Width / chkImage.Height) * cImgHeight
      If (chkImage.Height / chkImage.Width) * cImgWidth &gt; cImgHeight Then cImgHeight = (chkImage.Height / chkImage.Width) * cImgWidth
      irdGraphics.DrawImage(chkImage, boxX, boxY, cImgWidth, cImgHeight)
  
      ' Right Vertical Text        
      Dim rbWidth As Integer, rbHeight As Integer
      rbHeight = 2.25 * ppi : rbWidth = 2.25 * ppi : boxX = cImgWidth : boxY = 0.2 * ppi : boxX1 = irdWidth : boxY1 = boxY + rbHeight
      strFont = New Font(&quot;OCR-A Hanna&quot;, fontSize)
      textFormat.Alignment = StringAlignment.Center
      textFormat.LineAlignment = StringAlignment.Center
  
      strText = hsSeq &amp; vbNewLine &amp; &quot;*&quot; &amp; bankRt &amp; &quot;*  &quot; &amp; depDate
      stringSize = irdGraphics.MeasureString(strText, strFont)
      textFormat.FormatFlags = StringFormatFlags.DirectionVertical
      'irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX + (boxX1 - boxX - stringSize.Height / 2), boxY, boxX1, boxY1), textFormat)
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Point(boxX + stringSize.Width, boxY1 / 2 + boxY), textFormat)
  
      'Reprint on Image
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(0 + (boxX1 - boxX - stringSize.Width), boxY, boxX1 - boxX, boxY1), textFormat)
      'irdGraphics.ResetTransform()
  
      'Bottom Text        
      Dim bbWidth As Integer, bbHeight As Integer
      bbWidth = 2.25 * ppi : bbHeight = 0.2 * ppi : boxX = cImgWidth : boxY = 0.15 * ppi + boxY1 : boxX1 = boxX1 : boxY1 = boxY + bbHeight
      fontSize = 5
      strFont = New Font(&quot;OCR-A Hanna&quot;, fontSize, FontStyle.Bold)
  
      strText = &quot;↓ Do not endorse or write below this line. ↓&quot;
      irdGraphics.DrawString(strText, strFont, Brushes.Black, New Rectangle(boxX, boxY, boxX1, boxY1))
      irdGraphics.DrawLine(Pens.Black, New Point(boxX, boxY1), New Point(irdWidth, boxY1))
  
      Return irdImg
  
  End Function
  </code></pre>