Link to home
Start Free TrialLog in
Avatar of Kevin Terry
Kevin TerryFlag for United States of America

asked on


I know this topic has MANY questions/answers but I am still drawing blanks. Running Windows 10, Visual Studio 2019. I have created a Windows Forms App (.NET Framework). Target is .NET Framework 4.7.2. I have a Form created with a Panel on the form. The Panel is sized to 384x576 which is approximate 4" x 6". That is the exact size I have my page size set to. When I print preview (via code) it looks clear, but when it prints to my laser printer, some of the text is blurred. The text is a Label. My apologies up front, almost 80% of the code has been pieced together from "MANY" websites, so if you see any specific part of my code that looks like your code, sorry I am not giving proper credits in the footnotes.

Here is some of my code:


Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
   Dim myprintdialog As New PrintDialog memoryimage = New System.Drawing.Bitmap(Panel1.Width, Panel1.Height)
   Panel1.DrawToBitmap(memoryimage, Panel1.ClientRectangle)

       If myprintdialog.ShowDialog = DialogResult.OK Then
           Dim value As System.Drawing.Printing.PrinterSettings
           value = myprintdialog.PrinterSettings
           myprintdialog.Document = PrintDocument1
           PrintDocument1.PrintController = New StandardPrintController()
           Panel1.BackColor = Color.White
       End If
End Sub

Private Sub PrintPage(sender As Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles
    e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality
    e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
    e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
    e.Graphics.DrawImage(memoryimage, 0, 0)
End Sub

and added an app.manifest

   <?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="" name=""/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <requestedExecutionLevel level="asInvoker" uiAccess="false" />
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
  <dpiAware xmlns="">true</dpiAware>

Avatar of Dr. Klahn
Dr. Klahn

It's entirely possible for a window's contents to look great in Print Preview, but that's not what the printer actually gets from Windows when Print is clicked.  Print Preview shows what an ideal printer would do if it was fed that page with perfect resolution -- not what it will look like on the paper.

384x576 is very low resolution when printers normally have resolutions of 400 to 1200 DPI.  In order to blow up that low resolution text to a size where it can be printed, it is being aliased and anti-aliased without mercy by Windows.

What you can do about it:  Try different printface sizes, perhaps?
Avatar of Kevin Terry
Kevin Terry
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kevin Terry


I had a suspicion that it was resolution. I have 2 large monitors and used a ruler to measure the 4x6 panel that is on my form. VERY VERY close to 4x6. I have my printer paper size set to 4x6. I'm not understanding why Windows is having to blow something up? Would it be better for me to create a panel twice the size and let Windows scale it down?
My computer monitor resolution is set to 1920x1080. My printer is a Brother Laser HL-L2325DW and its resolution is 600 x 600 dpi, HQ1200 (2400 x 600 dpi) quality, 1200 x 1200 dpi. It is the 4x6 winform panel i'm trying to print on a 4x6 piece of paper. Is this not a 1:1 ratio? If anything i would think windows would be scaling down to the printer.