1

I am handling the PrintPageEventHandler of the PrintDocument in order to draw an image to the Graphics device using the Image.FromFile Method.

I tried to set the dpi values up to 600 and also

graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode  = SmoothingMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality

As suggested here but the printed image looks still pixeled and rough compared to printing the same file with e.g. Windows Photo Viewer , which gives a excellent result (tested on Windows 7).

I noticed that Paint.net uses WIA Printing Dialog - does this mean the Imagequality is a .NET limitation or am i just doing it wrong?

the complete method is here:

private void pd_PrintPage(object sender, PrintPageEventArgs ev)
    {
        // Draw a picture.
        ev.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
        ev.Graphics.SmoothingMode = SmoothingMode.HighQuality;
        ev.Graphics.CompositingQuality = CompositingQuality.HighQuality;
        ev.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; 

        ev.Graphics.DrawImage(Image.FromFile(Global.APPDATA_PATH+ @"tmp\print.png"), ev.Graphics.VisibleClipBounds);

        // Indicate that this is the last page to print.
        ev.HasMorePages = false;
    }
Community
  • 1
  • 1
d-fens_
  • 67
  • 6
  • Random question, are you using Windows 8? I found the quality of printouts decreased significantly on Windows 8 when printing from .net like this compared to earlier versions, just curious if you are using Windows 8 also? – JMK Oct 29 '13 at 11:59
  • Also, what's your source? – trinaldi Oct 29 '13 at 12:02
  • @JMK, OP stated "tested on Windows 7". – Steve Oct 29 '13 at 12:40
  • @Steve, That was added after I asked the question, but thanks, didn't see it until now – JMK Oct 29 '13 at 12:48

1 Answers1

0

Ok this is embarrasing:

the best quality like identical to what win7 does is to not define any options at all!

The Code was developed under XP, so there must have been some changes under the hood so win7 handles that differently.

private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
    // Draw a picture.
    ev.Graphics.DrawImage(Image.FromFile(Global.APPDATA_PATH+ @"tmp\print.png"), ev.Graphics.VisibleClipBounds);

    // Indicate that this is the last page to print.
    ev.HasMorePages = false;
}

simple as that :|

d-fens_
  • 67
  • 6